From: nobu.nokada@... Date: 2002-12-19T10:35:40+09:00 Subject: Re: Mommy, where do methods come from? Hi, At Thu, 19 Dec 2002 07:41:14 +0900, Joel VanderWerf wrote: > Christoph wrote: > > module Kernel > > def methodClass(m) > > m = m.to_s > > # catch method undef's > > respond_to?(m) or return nil > > # meta class is first inline > > extended_anc = self.class.ancestors.unshift(class << self; self end) > > extended_anc.find {|c| c.instance_methods.include?(m) } > > end > > end > > Hm. Since #respond_to? is doing this work alread, maybe it would make > sense for it to return the Module where it finds a method, instead of > just true? Maybe nice. > Sorta like how defined?(arg) returns not just a boolean value but the > kind of thing arg is. defined?(arg) returns a string represents type of arg or nil, not true/false. -- Nobu Nakada