Sha256: 0137d06e3914c27e7c8bbe50011047673cc0a43b7a175c5e5018488d75caf725

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 Bytes

Contents

require 'puppet/parser/ast/branch'

class Puppet::Parser::AST
    # A statement syntactically similar to an ResourceDef, but uses a
    # capitalized object type and cannot have a name.  
    class ResourceDefaults < AST::Branch
        attr_accessor :type, :params

        # As opposed to ResourceDef, this stores each default for the given
        # object type.
        def evaluate(hash)
            scope = hash[:scope]

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.24.0 lib/puppet/parser/ast/resource_defaults.rb
puppet-0.24.1 lib/puppet/parser/ast/resource_defaults.rb