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
0
59
Equality in Ruby
Romain Sempé
August 14, 2012
Tweet
Share
More Decks by Romain Sempé
See All by Romain Sempé
Are you happy with your code quality?
rsempe
0
81
Scan security of your Rails app with Brakeman
rsempe
2
190
Other Decks in Programming
See All in Programming
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
150
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.5k
AI Assistants for YourAngular Solutions @Angular Graz, March 2026
manfredsteyer
PRO
0
110
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
110
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
4
2k
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
1.1k
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
340
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.1k
Understanding Apache Lucene - More than just full-text search
spinscale
0
140
AI活用のコスパを最大化する方法
ochtum
0
340
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
110
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
150
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Exploring anti-patterns in Rails
aemeredith
2
290
My Coaching Mixtape
mlcsv
0
86
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
110
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
460
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?