From: Mark Volkmann Date: 2006-02-22T00:51:16+09:00 Subject: Re: "exporting" module methods On 2/21/06, dblack@wobblini.net wrote: > Hi -- > > On Wed, 22 Feb 2006, Mark Volkmann wrote: > > > On 2/21/06, dblack@wobblini.net wrote: > > > >> I don't think that's what Xavier wanted; I think he wanted C to be > >> able to call M.croak. (Also, in your example, c doesn't respond to > >> croak.) > > > > Wow! I have a fundamental misunderstanding of mixins apparently. I > > see that you are correct. c doesn't respond to croak in the following > > code. However, I don't understand why. Doesn't the include add > > instance methods from the module M to the class C? > > > > module M > > def self.croak > > puts 'croak' > > end > > end > > > > class C > > include M > > end > > > > c = C.new > > c.croak > > Yes, but croak isn't an instance method :-) (Note the "self." part.) Silly me! I briefly crossed things in my mind and thought that including "self." made it an instance method ... and I thought I got enough sleep last night. ;-) -- R. Mark Volkmann Partner, Object Computing, Inc.