[Ruby] copying methods around

John Whitley whitley at bangpath.org
Tue Mar 20 19:44:04 PST 2007


John Whitley wrote:
> class << os; include MyMod; end

crikey.  avert your eyes from the above; pay it no heed.

os.extend(MyMod)

If you had a list of method-modules, you can even do:

os.extend(*gnarly_bunches_o_method_modules)

-- John




More information about the Ruby mailing list