Dave Burt
3/23/2006 1:58:00 PM
Lindsay Boyd:
> Thanks Mike - I was trying '2.sqrt'. No wonder that didn't work!
Yeah, I've always wanted to do that kind of thing, too... let's try this:
class Numeric
Math.methods(false).each do |m|
define_method(m) {|*args| Math.send(m, self, *args) }
end
end
2.sqrt #=> 1.4142135623731
Floating-pointilicius!
Cheers,
Dave