From: luke gruber Date: 2011-11-08T02:00:10+09:00 Subject: Re: Tricky DSL, how to do it? > Sean O'halpin wrote in post #1030618: > On Sun, Nov 6, 2011 at 10:35 PM, Intransition > class Evaluator < BasicObject > def initialize(&block) > @__config__ = {} > if block > @context = block.binding.eval("self") > instance_eval(&block) That's a nice solution, I like that. I came up with something similar after I posted last night, but I like this more. Aside: What's with threads sneaking their way into other ones? I can't be the only one seeing "Newbie:: Understand Constructor Flow" alongside the "Tricky DSL" one. Sorry if this has been discussed elsewhere. > Posted by Robert Klemme > You can't have both (evaluate with self = Evaluator to trigger > Evaluator's method missing and invoking the block in the defining > context) at the same time. I'm not sure I understand what you're saying. With some solutions being posted above, at least 'self' is changed in the invoked block. That seems to be what Thomas was looking for, at least from my understanding. Can you elaborate on what you said? Thanks, -Luke -- Posted via http://www.ruby-forum.com/.