Sha256: 18316ba721d47e114394cfc82187ff82c9556a768ac5cf7beeabdee6fe326008

Contents?: true

Size: 828 Bytes

Versions: 212

Compression:

Stored size: 828 Bytes

Contents

# The parameters we stick in Resources.
class Puppet::Parser::Resource::Param
  include Puppet::Util
  include Puppet::Util::Errors

  attr_accessor :name, :value, :source, :add, :file, :line

  def initialize(name: nil, value: nil, source: nil, line: nil, file: nil, add: nil)
    @value = value
    @source = source
    @line = line
    @file = file
    @add = add

    unless name
      # This must happen after file and line are set to have them reported in the error
      self.fail(Puppet::ResourceError, "'name' is a required option for #{self.class}")
    end
    @name = name.intern
  end

  def line_to_i
    line ? Integer(line) : nil
  end

  def to_s
    "#{self.name} => #{self.value}"
  end

  def self.from_param(param, value)
    new_param = param.dup
    new_param.value = value
    return new_param
  end
end

Version data entries

212 entries across 212 versions & 1 rubygems

Version Path
puppet-7.17.0 lib/puppet/parser/resource/param.rb
puppet-7.17.0-x86-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.17.0-x64-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.17.0-universal-darwin lib/puppet/parser/resource/param.rb
puppet-6.27.0 lib/puppet/parser/resource/param.rb
puppet-6.27.0-x86-mingw32 lib/puppet/parser/resource/param.rb
puppet-6.27.0-x64-mingw32 lib/puppet/parser/resource/param.rb
puppet-6.27.0-universal-darwin lib/puppet/parser/resource/param.rb
puppet-7.16.0 lib/puppet/parser/resource/param.rb
puppet-7.16.0-x86-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.16.0-x64-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.16.0-universal-darwin lib/puppet/parser/resource/param.rb
puppet-7.15.0 lib/puppet/parser/resource/param.rb
puppet-7.15.0-x86-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.15.0-x64-mingw32 lib/puppet/parser/resource/param.rb
puppet-7.15.0-universal-darwin lib/puppet/parser/resource/param.rb
puppet-6.26.0 lib/puppet/parser/resource/param.rb
puppet-6.26.0-x86-mingw32 lib/puppet/parser/resource/param.rb
puppet-6.26.0-x64-mingw32 lib/puppet/parser/resource/param.rb
puppet-6.26.0-universal-darwin lib/puppet/parser/resource/param.rb