Skip to content

Instantly share code, notes, and snippets.

@delba
Last active December 17, 2015 20:19
Show Gist options
  • Select an option

  • Save delba/5666507 to your computer and use it in GitHub Desktop.

Select an option

Save delba/5666507 to your computer and use it in GitHub Desktop.
Ruby refinements
module FloatDivision
refine Fixnum do
def /(other)
self.to_f / other
end
end
end
using FloatDivision
class MathFun
def self.ratio(a, b)
a / b
end
end
p MathFun.ratio(6, 8) #=> 0.75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment