Skip to content

Instantly share code, notes, and snippets.

@etiennebarrie
Created February 3, 2010 00:17
Show Gist options
  • Select an option

  • Save etiennebarrie/293197 to your computer and use it in GitHub Desktop.

Select an option

Save etiennebarrie/293197 to your computer and use it in GitHub Desktop.
o = Object.new
def o.==(num)
true
end
puts o == 42
puts [o].include?(42)
puts [o].include?("a")
puts [o].include?(nil)
puts [o].include?(Object.new)
# MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
# true
# true
# false
# false
# false
#
# ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
# ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]
# true
# true
# true
# true
# true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment