Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Symbols and Hashes Intro
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Saurabh Bhatia
April 25, 2013
Technology
0
60
Symbols and Hashes Intro
Intro to Symbols and Hashes
Saurabh Bhatia
April 25, 2013
Tweet
Share
More Decks by Saurabh Bhatia
See All by Saurabh Bhatia
Barrister RPC
thewub
0
450
RulingOrbit
thewub
0
390
Rails API
thewub
0
440
Cloud Primer
thewub
1
410
Other Decks in Technology
See All in Technology
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
0
150
モブプログラミング再入門 ー 基本から見直す、AI時代のチーム開発の選択肢 ー / A Re-introduction of Mob Programming
takaking22
5
1.5k
複数クラスタ運用と検索の高度化:ビズリーチにおけるElastic活用事例 / ElasticON Tokyo2026
visional_engineering_and_design
0
160
フロントエンド刷新 4年間の軌跡
yotahada3
0
350
Go標準パッケージのI/O処理をながめる
matumoto
0
210
JAWS DAYS 2026 楽しく学ぼう!ストレージ 入門
yoshiki0705
2
190
ナレッジワークのご紹介(第88回情報処理学会 )
kworkdev
PRO
0
210
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
8
7.2k
SRE NEXT 2026 CfP レビュアーが語る聞きたくなるプロポーザルとは?
yutakawasaki0911
1
340
It’s “Time” to use Temporal
sajikix
1
150
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
120
チームのモメンタムに投資せよ! 不確実性と共存しながら勢いを生み出す3つの実践
kakehashi
PRO
1
100
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
970
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
76
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
260
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
150
The SEO Collaboration Effect
kristinabergwall1
0
390
Documentation Writing (for coders)
carmenintech
77
5.3k
Building Applications with DynamoDB
mza
96
7k
Transcript
Strings and Hashes
What is it ? • Symbol is something used to
represent a string. • A more memory efficient and descriptive way to do things.
How does it look ? Colon followed by a non-quoted
string - :symbol Or Colon followed by quoted string - :'this is another symbol'
Assigning stuff to symbols • :my_symbol = “foo_bar” - wrong
• my_symbol = :foo_bar – right • attr_accessor :foo_bar • my_symbol = :foo_bar.to_s
Symbols are immutable
hash • Data structure – collection of key value pairs
• Indexing via keys of object _type • Randomly ordered
What does it look like ? • animals = Hash.new
• animals["dog"] = "bark" • pry(main)> animals => {"dog"=>"bark", "cat"=>"purr"}
• Iterating over an array • animal_farm.each do |a| puts
a end • Iterating over a hash • animals.each do |k,v| puts “#{k} and #{v} end
exercise • Create a hash to represent currencies eg USA
=> usd , UK => gbp, JAPAN => yen • Display all the currencies • Replace all the name of countries with their short codes eg US -> US, JAPAN –> JP, UK -> UK
Solution • currencies = { “USA” => “usd” , “UK”
=> “gbp”, “JAPAN” => “yen” } • new_currencies = {"US" => "usd", "UK" => "gbp", “JP” => “yen”} • Hash[currencies.map {|k, v| [new_currencies[k], v] }]