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
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
940
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
CSC307 Lecture 07
javiergs
PRO
0
550
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
ぼくの開発環境2026
yuzneri
0
190
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
SourceGeneratorのススメ
htkym
0
190
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
540
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
190
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
260
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
710
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
300
Building an army of robots
kneath
306
46k
Tell your own story through comics
letsgokoyo
1
810
Fireside Chat
paigeccino
41
3.8k
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
Un-Boring Meetings
codingconduct
0
200
My Coaching Mixtape
mlcsv
0
47
Site-Speed That Sticks
csswizardry
13
1.1k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Navigating Team Friction
lara
192
16k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
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?