Refinements for JRubyArt
Headius has now fixed to some extent refinements in JRuby, thus it should be possible to use refinements to provide :radians
and :degrees
methods to Numeric, rather than monkey patching global space.
module SuperNumeric
refine Numeric do
def degrees
self * 57.29577951308232
end
def radians
self * 0.017453292519943295
end
end
end
using SuperNumeric
puts 45.radians
puts 0.7853981634.degrees