class Puppet::Parser::AST::ResourceReference

Attributes

title[RW]
type[RW]

Public Instance Methods

evaluate(scope) click to toggle source

Evaluate our object, but just return a simple array of the type and name.

# File lib/puppet/parser/ast/resource_reference.rb, line 9
def evaluate(scope)
  titles = Array(title.safeevaluate(scope)).flatten

  a_type, titles = scope.resolve_type_and_titles(type, titles)

  resources = titles.collect{ |a_title|
    Puppet::Resource.new(a_type, a_title)
  }

  return(resources.length == 1 ? resources.pop : resources)
end
to_s() click to toggle source
# File lib/puppet/parser/ast/resource_reference.rb, line 21
def to_s
  if title.is_a?(Puppet::Parser::AST::ASTArray)
    "#{type.to_s.capitalize}#{title}"
  else
    "#{type.to_s.capitalize}[#{title}]"
  end
end