On 8/16/05, Ara.T.Howard <Ara.T.Howard / noaa.gov> wrote:
> On Tue, 16 Aug 2005, Joe Van Dyk wrote:
> 
> > module JoeAccessors
> >  class << self
> >    def joe_accessor_method *args
> >      args.each do |arg|
> >        eval <<-src
> >          def #{ arg }
> >            @#{ arg }
> >          end
> >          def #{ arg }= value
> >            @#{ arg } = value
> >          end
> >        src
> >      end
> >    end
> >  end
> > end
> >
> > class Joe
> >  include JoeAccessors
> >  joe_accessor_method :arg1, :arg2
> > end
> >
> >> test.rb:21: undefined method `joe_accessor_method' for Joe:Class (NoMethodError)
> >
> > *bangs head against desk*
> 
> you're close - the issue is that including a module in another class/module
> only inserts the __instance__ methods of the included module into the
> class/module doing the reciever.  so, altough you've defined a class level
> method correctly it doesn't make it into your new class.  

What's the rationale behind that?