From: Joel VanderWerf Date: 2004-03-26T04:34:15+09:00 Subject: Re: module and alias_method Raphael Bauduin wrote: > Hi, > > is it possible, in a module, to create an alias for a method of the > object including it? > > module CKHTMLTableUser alias_method :normal_init, :init def init > if request["action"] > send("#{request['action']}_action") > end > normal_init > end > end module CKHTMLTableUser def self.included(cl) cl.class_eval do alias_method :normal_init, :init def init puts "init from CKHTMLTableUser" normal_init end end end end class C # include CKHTMLTableUser # This way won't work. def init puts "init from C" end include CKHTMLTableUser end C.new.init