Class: Puppet::Parser::Compiler
- Inherits:
-
Object
- Object
- Puppet::Parser::Compiler
- Defined in:
- lib/rspec-hiera-puppet/puppet.rb
Instance Method Summary collapse
- #compile ⇒ Object
- #compile_unadorned ⇒ Object
- #register_function_hiera(spec) ⇒ Object
- #register_function_hiera_array(spec) ⇒ Object
- #register_function_hiera_hash(spec) ⇒ Object
- #register_function_hiera_include(spec) ⇒ Object
Instance Method Details
#compile ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 6 def compile spec = Thread.current[:spec] if spec register_function_hiera(spec) register_function_hiera_array(spec) register_function_hiera_hash(spec) register_function_hiera_include(spec) end compile_unadorned end |
#compile_unadorned ⇒ Object
4 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 4 alias_method :compile_unadorned, :compile |
#register_function_hiera(spec) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 19 def register_function_hiera(spec) Puppet::Parser::Functions.newfunction(:hiera, :type => :rvalue) do |*args| require 'hiera_puppet' key, default, override = HieraPuppet.parse_args(args) HieraPuppet.lookup(key, default, self, override, :priority) end end |
#register_function_hiera_array(spec) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 27 def register_function_hiera_array(spec) Puppet::Parser::Functions.newfunction(:hiera_array, :type => :rvalue) do |*args| require 'hiera_puppet' key, default, override = HieraPuppet.parse_args(args) HieraPuppet.lookup(key, default, self, override, :array) end end |
#register_function_hiera_hash(spec) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 35 def register_function_hiera_hash(spec) Puppet::Parser::Functions.newfunction(:hiera_hash, :type => :rvalue) do |*args| require 'hiera_puppet' key, default, override = HieraPuppet.parse_args(args) HieraPuppet.lookup(key, default, self, override, :hash) end end |
#register_function_hiera_include(spec) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rspec-hiera-puppet/puppet.rb', line 43 def register_function_hiera_include(spec) Puppet::Parser::Functions.newfunction(:hiera_include) do |*args| require 'hiera_puppet' key, default, override = HieraPuppet.parse_args(args) answer = HieraPuppet.lookup(key, default, self, override, :array) method = Puppet::Parser::Functions.function(:include) send(method, answer) end end |