On Jul 15, 2008, at 5:15 PM, Adam Jacob wrote:

> I've done a bit of digging in the template class, and I think you  
> might be able to refactor it thusly:
>
> Look up all the variables in @scope, and turn them in to  
> instance_variables of the template wrapper class.  This would let  
> you do:
>
> <%= @operatingsystem == "foo" %>
>
> Instead of the current
>
> <%= @operatingsystem == "foo" %>
>
> If you really want to have local variables, we could do the same  
> thing within a lambda, and use that as the binding:
>
> <%= operatingsystem == "foo" %>
>
> That would eliminate the need for the method_missing entirely.


Not quite -- you'd need to recursively do this all the way up the  
scope chain.  For instance, 'operatingsystem' is set at the top-level  
scope, so it wouldn't even show up except in the top-level scope.

This wouldn't make things fabulously more expensive, but it would have  
an impact, and it's why I didn't do things this way to start with.

-- 
On Bureaucracy....
     The Pythagorean theorem contains 24 words. Archimedes
Principle, 67. The Ten Commandments, 179. The American Declaration of
Independence, 300. And recent legislation in Europe concerning when
and where to smoke, 23,942. -- The European, June 23-29, 1995
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to