Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Symbols and Hashes Intro
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Saurabh Bhatia
April 25, 2013
Technology
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Symbols and Hashes Intro
Intro to Symbols and Hashes
Saurabh Bhatia
April 25, 2013
More Decks by Saurabh Bhatia
See All by Saurabh Bhatia
Barrister RPC
thewub
0
470
RulingOrbit
thewub
0
390
Rails API
thewub
0
460
Cloud Primer
thewub
1
420
Other Decks in Technology
See All in Technology
Coil3を内部実装から読み解く~キャッシュ戦略とAVIF画像の描画〜/nikkei-tech-talk50
nikkei_engineer_recruiting
0
110
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
300
サーバーレスをどこまで使う? WebRTC対戦ゲームで選んだVPSとの共存設計
kaidouji85
0
450
AI感のないAWS構成図をAIエージェントに描かせたい!
sagochiko
2
410
10年欲しかった音楽管理アプリを、AIと一緒に作りはじめた
judau
1
130
「今盗んで、後で解く」に備える ― AWSのポスト量子暗号入門
yama3133
2
250
高負荷プロダクション環境におけるAWS Lambdaのリアル 〜スケールとコストを左右する実行ライフサイクルの技術仕様〜
maimyyym
2
650
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
Harness Engineering on Rails
joelq
0
580
覗いてみよう 関数型ビジュアル言語×2Dグラフィックスの世界
yohyamasaki
0
120
AIに会社の文脈を理解させる技術~上流工程・非エンジニアにも広げるハーネスエンジニアリング実践~
ochtum
0
110
なぜAI任せのゲームは面白くならないのか?
hirohasuyoutube
0
130
Featured
See All Featured
How Software Deployment tools have changed in the past 20 years
geshan
2
34k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Agile that works and the tools we love
rasmusluckow
331
22k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
260
So, you think you're a good person
axbom
PRO
2
2.2k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
850
Code Reviewing Like a Champion
maltzj
528
40k
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] }]