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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Saurabh Bhatia
April 25, 2013
Technology
0
59
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
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
190
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
2k
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
260
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
650
Red Hat OpenStack Services on OpenShift
tamemiya
0
120
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
680
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
200
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
17k
20260204_Midosuji_Tech
takuyay0ne
1
160
What happened to RubyGems and what can we learn?
mikemcquaid
0
310
超初心者からでも大丈夫!オープンソース半導体の楽しみ方〜今こそ!オレオレチップをつくろう〜
keropiyo
0
110
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Speed Design
sergeychernyshev
33
1.5k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
100
How GitHub (no longer) Works
holman
316
140k
We Have a Design System, Now What?
morganepeng
54
8k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
Code Review Best Practice
trishagee
74
20k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
KATA
mclloyd
PRO
34
15k
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] }]