Skip to content

Instantly share code, notes, and snippets.

@unicornrainbow
Created September 21, 2011 06:04
Show Gist options
  • Select an option

  • Save unicornrainbow/1231365 to your computer and use it in GitHub Desktop.

Select an option

Save unicornrainbow/1231365 to your computer and use it in GitHub Desktop.
==, eql?, equal?. Now we also have .eq
# Use .eq where you would use ==. Avoid accidental assignment.
#
# if 1.eq 1
# puts "They're equal"
# end
#
class Object
def eq(operand)
self == operand
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment