From: Sebastian Hungerecker Date: 2009-05-27T05:42:23+09:00 Subject: Re: How do Class definitions in Ruby differ from other OO languages? Am Dienstag 26 Mai 2009 00:05:07 schrieb kunjaan: > What do you mean when you say"Class definitions are executable code". It means that class definiton happens at runtime. You can have any valid ruby expressions inside a class body, and they will be executed as they encountered by the parser. Example: loops: class Foo (1..9).each do |i| define_method("add#{i}") do |x| x+i end end end Foo.instance_methods(false) #=>["add2", "add9", "add5", "add1", "add8", "add4", "add7", "add3", "add6"] Foo.new.add5(6) #=> 11