Last active
October 3, 2017 13:33
-
-
Save CraigMorton/254661d96657aa51c10b54e7e9234679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a_string = String.new('a_string') | |
another_string = String.new('another_string') | |
puts a_string | |
puts a_string.hash | |
puts another_string | |
puts another_string.hash | |
puts a_string.hash == another_string.hash | |
a_hash = {} | |
a_hash[a_string] = 5000 | |
a_hash[another_string] = 10 | |
puts a_hash | |
class BrokenString < String | |
def hash | |
return 1 | |
end | |
end | |
a_broken_string = BrokenString.new('a_broken_string') | |
another_broken_string = BrokenString.new('another_broken_string') | |
puts a_broken_string | |
puts a_broken_string.hash | |
puts another_broken_string | |
puts another_broken_string.hash | |
puts a_broken_string.hash == another_broken_string.hash | |
a_broken_hash = {} | |
a_broken_hash[a_broken_string] = 5000 | |
a_broken_hash[another_broken_string] = 10 | |
puts a_broken_hash | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment