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
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
680
What happened to RubyGems and what can we learn?
mikemcquaid
0
310
[CV勉強会@関東 World Model 読み会] Orbis: Overcoming Challenges of Long-Horizon Prediction in Driving World Models (Mousakhan+, NeurIPS 2025)
abemii
0
140
配列に見る bash と zsh の違い
kazzpapa3
3
160
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
580
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
220
StrandsとNeptuneを使ってナレッジグラフを構築する
yakumo
1
120
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
670
OpenShiftでllm-dを動かそう!
jpishikawa
0
130
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
17k
Featured
See All Featured
New Earth Scene 8
popppiees
1
1.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
AI: The stuff that nobody shows you
jnunemaker
PRO
2
270
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Paper Plane
katiecoart
PRO
0
46k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
350
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Google's AI Overviews - The New Search
badams
0
910
GitHub's CSS Performance
jonrohan
1032
470k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
170
Building Applications with DynamoDB
mza
96
6.9k
Abbi's Birthday
coloredviolet
1
4.8k
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] }]