Skip to content

Instantly share code, notes, and snippets.

@lukas2
Created September 22, 2014 08:25
Show Gist options
  • Save lukas2/c283fddad5d6883efee6 to your computer and use it in GitHub Desktop.
Save lukas2/c283fddad5d6883efee6 to your computer and use it in GitHub Desktop.
class Fixnum
alias_method :_div, :/
def /(a)
if a == 0
0
else
_div a
end
end
end
puts "9 / 2 = %f" % (9 / 2).to_f
puts "9 / 0 = %f" % (9 / 0).to_f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment