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
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
540
複雑なフォームに立ち向かう Next.js の技術選定
macchiitaka
2
230
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.9k
Kiroで始めるAI-DLC
kaonash
2
630
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
510
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
130
概念モデル→論理モデルで気をつけていること
sunnyone
3
300
Laravel Boost 超入門
fire_arlo
3
220
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
310
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
2k
Featured
See All Featured
Scaling GitHub
holman
463
140k
Statistics for Hackers
jakevdp
799
220k
KATA
mclloyd
32
14k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
For a Future-Friendly Web
brad_frost
180
9.9k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Designing for Performance
lara
610
69k
Producing Creativity
orderedlist
PRO
347
40k
Designing Experiences People Love
moore
142
24k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
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?