Luke Kanies <[EMAIL PROTECTED]> writes:
> 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:
[...]
>> 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.
Mmmm. So, do you have a strong preference for how this is fixed?
I did a bit more poking around in Ruby and found, sadly, that there
doesn't seem to be any way to create a module, proc or object that is
free of the standard bindings.
It also seems impossible to fiddle method visibility on a per-instance
basis, and prone to trouble to try and do it for the class, so it really
looks like /something/ has to give. :/
Is your preferred solution just to bind all variables into anonymous
methods?
Regards,
Daniel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---