Mega Code Archive

 
Categories / Ruby / Method
 

Bind a block to a method

def aMethod   return binding end the_binding = aMethod { puts "hello" } eval "yield", the_binding                # hello