From: Daniel Schierbeck Date: 2006-06-10T22:05:47+09:00 Subject: Re: Ruby Class question Peer Allan wrote: > ... I did not > realize that the code within the class definition gets executed, rather > than just defined. Neat! Yes, it's actually very neat -- you can put almost anything in there: class Foo if condition? then def bar(arg1, arg2) ... end end [:foo, :bar, :baz].each do |name| define_method(name){ puts name.inspect } end end Cheers, Daniel