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
58
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
80
Scan security of your Rails app with Brakeman
rsempe
2
190
Other Decks in Programming
See All in Programming
テストから始めるAgentic Coding 〜Claude Codeと共に行うTDD〜 / Agentic Coding starts with testing
rkaga
15
5.3k
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
5
650
生成AI時代のコンポーネントライブラリの作り方
touyou
1
260
A full stack side project webapp all in Kotlin (KotlinConf 2025)
dankim
0
130
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
170
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
670
NEWT Backend Evolution
xpromx
1
110
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
97
34k
VS Code Update for GitHub Copilot
74th
2
670
NPOでのDevinの活用
codeforeveryone
0
870
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
620
テスト駆動Kaggle
isax1015
1
510
Featured
See All Featured
Become a Pro
speakerdeck
PRO
29
5.4k
Navigating Team Friction
lara
187
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Scaling GitHub
holman
460
140k
Optimizing for Happiness
mojombo
379
70k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
How GitHub (no longer) Works
holman
314
140k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
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?