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
Equality in Ruby
Search
Romain Sempé
August 14, 2012
Programming
61
0
Share
Equality in Ruby
Romain Sempé
August 14, 2012
More Decks by Romain Sempé
See All by Romain Sempé
Are you happy with your code quality?
rsempe
0
84
Scan security of your Rails app with Brakeman
rsempe
2
190
Other Decks in Programming
See All in Programming
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
280
AIと共に生きる技術選定 2026
sgash708
0
140
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.8k
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
200
20260514_its_the_context_window_stupid.pdf
heita
0
1k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
670
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
540
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
190
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
1
130
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
210
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
290
Bash Introduction
62gerente
615
210k
How to make the Groovebox
asonas
2
2.2k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
Raft: Consensus for Rubyists
vanstee
141
7.4k
Docker and Python
trallard
47
3.8k
Crafting Experiences
bethany
1
150
Code Review Best Practice
trishagee
74
20k
Music & Morning Musume
bryan
47
7.2k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
Transcript
Equality in Ruby Romain Sempé @rsempe
Equality or Identity? Equality: Different objects that represent the
same value. Identity: Different variables that refer to the same object.
Equal yes! But in what sense? What equality methods
should we use? == eql? equal? === =~
== Test only if the objects have the same value.
eql? Test if the objects have the same value and
the same type.
equal? Test if the objects have the same value, the
same type and are the same instance in memory.
=== Same as == but for case statements. One operator
depending on the context of the comparison (Class, Range, Regexp, …).
=~ Interesting with the Regexp class. It’s an alias to
the match method.
Conclusion == is great most of the time
eql? and equal? can be useful to be more precise Elegant case statements with === Concise test for Regexp with =~ Only one identity operator: equal?