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 によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
700
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
550
CSC307 Lecture 09
javiergs
PRO
1
830
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
190
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
130
Apache Iceberg V3 and migration to V3
tomtanaka
0
150
Grafana:建立系統全知視角的捷徑
blueswen
0
330
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
今から始めるClaude Code超入門
448jp
8
8.6k
高速開発のためのコード整理術
sutetotanuki
1
390
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
4 Signs Your Business is Dying
shpigford
187
22k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.6k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Git: the NoSQL Database
bkeepers
PRO
432
66k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
280
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
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?