@davetron5000 IIRC, === on class Class is defined by class membership.

The default implementation of === is an alias of ==, but a few classes redefine it. You'll also get something surprising with instances of class Regex, too, because it's overridden to mean regex match.

irb(main):003:0> /a/ == /a/
=> true
irb(main):001:0> /a/ === /a/
=> false
irb(main):002:0> /a/ === 'a'
=> true

1
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Replies