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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.4k
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
Kiro Crewをはじめよう
kizawa2020
1
160
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
380
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
180
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
300
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
110
その Valkey 使いこなしていますか?
onk
PRO
5
1.5k
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
A Tale of Four Properties
chriscoyier
163
24k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
The browser strikes back
jonoalderson
0
1.8k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
Marketing to machines
jonoalderson
1
5.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
Embracing the Ebb and Flow
colly
88
5.2k
WENDY [Excerpt]
tessaabrams
14
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] }]