From: li shoubo Date: 2012-10-15T15:37:10+09:00 Subject: About define_method I want to define a method in kernel using Flattern Scope. Kernel.send :define_method, :each_event do events.each_pair do |message, condition| yield message, condition end end so, I think this is equal to: def Kernel.each_event events.each_pair do |message, condition| yield message, condition end end Then I can pass a block to this method, for example: Kernel.each_event do |message, condition| ..... end However, if I use send define_method method to define each_event, I would met a exception: in `each_event': no block given (LocalJumpError) I do not know why? if I do not use "send", the "yield" work well. Also, I can define method as follows according to "meta programming ruby" says: Kernel.send :define_method, :each_event do |&block| events.each_pair do |message, condition| block.call message, condition end end please help me to figure out why I can not use the first solution. -- Posted via http://www.ruby-forum.com/.