Sha256: bbd74b440245f8d12cd7e6da329d81545f457cfb2161c659181d09f11e723f6f

Contents?: true

Size: 860 Bytes

Versions: 8

Compression:

Stored size: 860 Bytes

Contents

# frozen_string_literal: true

# The AST object for the parameters inside resource expressions
#
class Puppet::Parser::AST::ResourceParam < Puppet::Parser::AST::Branch
  attr_accessor :value, :param, :add

  def initialize(argshash)
    Puppet.warn_once('deprecations', 'AST::ResourceParam', _('Use of Puppet::Parser::AST::ResourceParam is deprecated and not fully functional'))
    super(argshash)
  end

  def each
    [@param, @value].each { |child| yield child }
  end

  # Return the parameter and the value.
  def evaluate(scope)
    value = @value.safeevaluate(scope)
    return Puppet::Parser::Resource::Param.new(
      :name => @param,
      :value => value.nil? ? :undef : value,
      :source => scope.source,
      :line => self.line,
      :file => self.file,
      :add => self.add
    )
  end

  def to_s
    "#{@param} => #{@value}"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-8.5.1 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.1-x86-mingw32 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.1-x64-mingw32 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.1-universal-darwin lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.0 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.0-x86-mingw32 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.0-x64-mingw32 lib/puppet/parser/ast/resourceparam.rb
puppet-8.5.0-universal-darwin lib/puppet/parser/ast/resourceparam.rb