From: "cardboard42@..." Date: 2008-08-09T04:53:37+09:00 Subject: Re: Works in irb but not elsewhere On Aug 8, 3:26 pm, Patrick Li wrote: > Hi i'm creating a DSL, and would like to use the following > functionality.It works fine in irb but when I run it from the > commandline. Does it look like my fault or a ruby bug? > > class A > def method > puts "a" > end > def A.create > A.new.instance_eval { yield } > end > end > > A.create{method} Maybe I'm missing something, but shouldn't that be: class A def method puts "a" end def A.create &block A.new.instance_eval &block end end