From: Srijayanth Sridhar Date: 2009-05-08T14:49:13+09:00 Subject: Understanding { } and block_given --001e68378aa304607f046960305f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello, I have the following: class DSL def DSL.load filename dsl = new dsl.instance_eval(File.read(filename)) dsl end def to sym,*args,&block if block_given? b=class << self;self;end b.instance_eval { define_method(sym,*args,&block) } end end def method_missing sym,*args "#{sym}" end alias :say puts end foo=DSL.load("sample.dsl") sample.dsl: to smile do say ":)" end to be_polite { say "thank you" } smile be_polite The resulting output is: moonwolf@trantor:~/ruby/dsl/todo$ ./dsl.rb :) moonwolf@trantor:~/ruby/dsl/todo$ be_polite and indeed, anything enclosded in {} doesn't seem to be eval-ed as blocks. Why is this? Jayanth --001e68378aa304607f046960305f--