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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
700
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
190
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Basic Architectures
denyspoltorak
0
660
Architectural Extensions
denyspoltorak
0
280
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
160
Oxlint JS plugins
kazupon
1
830
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
660
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
Apache Iceberg V3 and migration to V3
tomtanaka
0
150
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
77
Designing for humans not robots
tammielis
254
26k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
79
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Technical Leadership for Architectural Decision Making
baasie
1
240
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
My Coaching Mixtape
mlcsv
0
47
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
49
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
100
A designer walks into a library…
pauljervisheath
210
24k
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?