DEV Community

loading...

Discussion on: Understanding Ruby - Triple Equals

Collapse
3limin4t0r profile image
3limin4t0r • Edited

Range#=== changed in 2.7. Before 2.7 it behaves like #include?, since 2.7 it behaves like #cover?

('1.2.3'..'11.22.33').include?('5.6.7') #=> true
('1.2.3'..'11.22.33').cover?('5.6.7')   #=> false

# pre 2.7
('1.2.3'..'11.22.33') === '5.6.7' #=> true
# 2.7 and later
('1.2.3'..'11.22.33') === '5.6.7' #=> false
Enter fullscreen mode Exit fullscreen mode
Collapse
baweaver profile image
Brandon Weaver Author

I should probably remember this as I was part of that discussion to get that changed over 😅