Class: Puppet::Parser::Scope
- Inherits:
-
Object
- Object
- Puppet::Parser::Scope
- Defined in:
- lib/puppet/macros.rb
Overview
Monkey patches to Scope, so we have convenient access to some methods from macros.
Instance Method Summary collapse
-
#call_macro(name, args = [], options = {}, env = Puppet::Macros.default_environment) ⇒ Object
Call macro registered with Macros.newmacro.
-
#fr2r(v) ⇒ Object
Convert value from facter to ruby.
-
#pp2r(v) ⇒ Object
Convert puppet value to ruby.
Instance Method Details
#call_macro(name, args = [], options = {}, env = Puppet::Macros.default_environment) ⇒ Object
Call macro registered with Macros.newmacro
14 15 16 17 18 19 |
# File 'lib/puppet/macros.rb', line 14 def call_macro(name, args = [], = {}, env = Puppet::Macros.default_environment) # FIXME: I believe I should use environment that is bound to scope, not the # Macros.default_environment, but at the moment I have no idea where to # find it Puppet::Macros.call_macro(self,name,args,,env) end |
#fr2r(v) ⇒ Object
Convert value from facter to ruby.
This converts empty strings and :undefined symbol to nil.
37 38 39 |
# File 'lib/puppet/macros.rb', line 37 def fr2r(v) (v.equal?(:undefined) or v == '') ? nil : v end |
#pp2r(v) ⇒ Object
Convert puppet value to ruby.
This converts empty strings and :undefs to nil.
27 28 29 |
# File 'lib/puppet/macros.rb', line 27 def pp2r(v) (v.equal?(:undef) or v == '') ? nil : v end |