From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-24T00:58:50+09:00 Subject: including modules => installing modules I have some modules where I must use 'alias' in order to use them. But it tends to be nasty. I guess its possible to make an install method, which creates the necessary aliases and then extends the specified class. Is this possible ? How should it be done ? -- Simon Strandgaard > expand -t2 a.rb module ArrayStuff def new_push(*ary) puts "Array#push: enter - #{ary.inspect}" old_push(*ary) puts "Array#push: leave" self end def ArrayStuff.install(klass) # what should I write here ? end end # ArrayStuff.install(Array) class Array alias :old_push :push # nasty include ArrayStuff alias :push :new_push # nasty end p [1, 2].push(*[]) p [1, 2].push(*[4, 5]) > > ruby a.rb Array#push: enter - [] Array#push: leave [1, 2] Array#push: enter - [4, 5] Array#push: leave [1, 2, 4, 5] >