From: Aldric Giacomoni Date: 2009-11-20T03:45:06+09:00 Subject: Re: Re-opening an existing module and changing a method Jes炭s Gabriel y Gal叩n wrote: > irb(main):003:1> class << self > irb(main):004:2> alias :old_sqrt :sqrt > irb(main):005:2> end Ah-ha! My version is underneath. So, what the bit of code I quoted does is.. It reopens "the class of the module" to make a change in the alias? module Math class << self alias :old_sqrt :sqrt end def self.sqrt x result = old_sqrt(x) if result.is_a? Float "sqrt(#{x})" else result end end end >> puts Math.sqrt(2) => sqrt(2) -- Posted via http://www.ruby-forum.com/.