From: Gennady Bystritsky Date: 2005-04-14T12:37:18+09:00 Subject: Re: self module MyModule def do_something puts "success" end end class MyClass extend MyModule end MyClass.do_something # ==> success This will work too: class MyClass extend MyModule do_something end On Apr 13, 2005, at 8:07 PM, Douglas Livingstone wrote: > class MyClass > def self.do_something > puts 'success' > end > do_something > end > > This puts 'success' - this is a a class method right? > > How do I move the "def self..end" section into a module? Trying the > obvious: > > module MyModule > def self.do_something > puts 'success' > end > end > > class MyClass > include MyModule > do_something > end > > doesn't seem to work, but this does: > > module MyModule > def do_something > puts 'success' > end > end > > class MyClass > include MyModule > def ex > do_something > end > end > > MyClass.new.ex > > Here, is "run" an instance method, which is why it can only be called > from a #new instance? How do I get it to get called from this: > > class MyClass > include MyModule > do_something > end > > Thanks, > Douglas >