[Rails] limitations of passing a block to class_eval

2012-10-19 Thread John Merlino
One shortcoming of define_method is that it does not allow you to specify a method body that expects a block. If you need to dynamically create a method that accepts a block, you will need to use the def statement within class_eval. Here's a trivial example: class Module def acts_as_thing(name,

Re: [Rails] limitations of passing a block to class_eval

2012-10-19 Thread Jordon Bedwell
On Fri, Oct 19, 2012 at 8:28 PM, John Merlino stoici...@aol.com wrote: One shortcoming of define_method is that it does not allow you to specify a method body that expects a block. If you need to dynamically create a method that accepts a block, you will need to use the def statement within