Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Symbols and Hashes Intro
Search
Saurabh Bhatia
April 25, 2013
Technology
0
56
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
オープンソースKeycloakのMCP認可サーバの仕様の対応状況 / 20251219 OpenID BizDay #18 LT Keycloak
oidfj
0
180
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
0
450
AI with TiDD
shiraji
1
300
株式会社ビザスク_AI__Engineering_Summit_Tokyo_2025_登壇資料.pdf
eikohashiba
1
120
AWSに革命を起こすかもしれない新サービス・アップデートについてのお話
yama3133
0
510
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
2
200
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
490
Identity Management for Agentic AI 解説
fujie
0
480
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
140
AI駆動開発の実践とその未来
eltociear
2
500
「図面」から「法則」へ 〜メタ視点で読み解く現代のソフトウェアアーキテクチャ〜
scova0731
0
520
Amazon Bedrock Knowledge Bases × メタデータ活用で実現する検証可能な RAG 設計
tomoaki25
6
2.4k
Featured
See All Featured
So, you think you're a good person
axbom
PRO
0
1.8k
sira's awesome portfolio website redesign presentation
elsirapls
0
91
Designing for humans not robots
tammielis
254
26k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
230
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Crafting Experiences
bethany
0
22
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.4k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
270
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
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] }]