Class: Puppet::Parser::AST::ResourceDefaults

Inherits:
Branch show all
Defined in:
lib/puppet/parser/ast/resource_defaults.rb

Overview

A statement syntactically similar to an ResourceDef, but uses a capitalized object type and cannot have a name.

Instance Attribute Summary collapse

Attributes inherited from Branch

#children, #pin

Instance Method Summary collapse

Methods inherited from Branch

#each, #initialize

Constructor Details

This class inherits a constructor from Puppet::Parser::AST::Branch

Instance Attribute Details

#parametersObject



7
8
9
# File 'lib/puppet/parser/ast/resource_defaults.rb', line 7

def parameters
  @parameters
end

#typeObject



7
8
9
# File 'lib/puppet/parser/ast/resource_defaults.rb', line 7

def type
  @type
end

Instance Method Details

#evaluate(scope) ⇒ Object

As opposed to ResourceDef, this stores each default for the given object type.



13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/parser/ast/resource_defaults.rb', line 13

def evaluate(scope)
  # Use a resource reference to canonize the type
  ref = Puppet::Resource.new(@type, "whatever")
  type = ref.type
  params = @parameters.safeevaluate(scope)

  parsewrap do
    scope.define_settings(type, params)
  end
end