Dave Birch wrote:
> Hi,
> 
> I'm trying to implement a simple parser and quite likely going about it
> the wrong way.
> 
> I would like to be able to include a bit of ruby code in a string, which
> is saved to a field in a database.  When the string is retrieve from the
> database at a later stage, I want to parse it for code and evaluate the
> code, substituting the result value into the string.

You are aware of the serious security problems with this, right?

[...]
> But I cannot work out how to get the scope of the class within
> which Substitutable has been "include"d.  

Perhaps you should use the Module#included callback to register it.

Best,
--??
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.