From: ts Date: 2003-06-24T01:07:50+09:00 Subject: Re: including modules => installing modules >>>>> "S" == Simon Strandgaard <0bz63fz3m1qt3001@sneakemail.com> writes: S> I guess its possible to make an install method, which creates S> the necessary aliases and then extends the specified class. This is just an example svg% cat b.rb #!/usr/bin/ruby module ArrayStuff def new_push(*ary) puts "Array#push: enter - #{ary.inspect}" old_push(*ary) puts "Array#push: leave" self end def self.append_features(klass) super klass.instance_eval do alias_method :old_push, :push alias_method :push, :new_push end end end class Array include ArrayStuff end p [1, 2].push(*[]) p [1, 2].push(*[4, 5]) svg% svg% b.rb Array#push: enter - [] Array#push: leave [1, 2] Array#push: enter - [4, 5] Array#push: leave [1, 2, 4, 5] svg% Guy Decoux