From: Sean O'Halpin Date: 2005-10-18T10:38:30+09:00 Subject: Re: Class method aliasing On 10/18/05, Bob Hutchison wrote: > Hi, > > I'd like to confirm that I cannot use any kind of aliasing to tidy up > the following situation: [snip example - see below] > I guess what I'm trying to do is make class/module methods directly > available to instances, and it seems I can't do that (whatever the > reason). > > Any better ideas are more than welcome. > > Cheers, > Bob How about this? class Class def class_function(name) class_eval { define_method(name, &method(name)) } end end class Junk def Junk.info "blah blah blah from #{self}" end class_function :info end puts Junk.info junk = Junk.new puts junk.info __END__ blah blah blah from Junk blah blah blah from Junk Regards, Sean