Skip to content

Instantly share code, notes, and snippets.

@newmana
Last active August 29, 2015 13:57
Show Gist options
  • Save newmana/9749396 to your computer and use it in GitHub Desktop.
Save newmana/9749396 to your computer and use it in GitHub Desktop.
Hash uses eql? not ==
2.1.1 :001 > {2 => "foo", 2.0 => "bar"}
=> {2=>"foo", 2.0=>"bar"}
2.1.1 :002 > 2 == 2.0
=> true
2.1.1 :003 > 2.eql?(2.0)
=> false
@michael-harrison
Copy link

In the C code they use a macro EQUAL. I didn't look too closely but it could be calling the eql? method. On the equ? vs == method check out this: http://blog.elpassion.com/ruby-gotchas/

@newmana
Copy link
Author

newmana commented Mar 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment