"Erik Veenstra" <google / erikveen.dds.nl> writes:

>> After messing up with racc for a couple of hours I realized
>> that most of the parse functions look pretty much the same,
>> so I thought of stretching my metaprogramming muscles and I
>> wrote my first meta_parse function.
>>
>> I would like to hear your comments on it, but please be
>> gentle ;-)
>
> I usually try to avoid those inline strings. I don't like them.
> As long as you don't pass a block in the call to the
> dynamically defined method, you can use "define_method"
> instead. I moved a bit of code and came up with the code below.

I'd just return a block for this case, though.

>  def meta_parse(*ary)
>    self.class.module_eval do
>      define_method :parse do |str|
...
>      end
>    end
>  end
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org