Class: Puppet::Parser::Resource::Param

Inherits:
Object
  • Object
show all
Includes:
Util, Util::Errors
Defined in:
lib/puppet/parser/resource/param.rb

Overview

The parameters we stick in Resources.

Constant Summary

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE, Util::RFC_3986_URI_REGEX

Constants included from Util::SymbolicFileMode

Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit

Constants included from Util::POSIX

Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::Errors

#adderrorcontext, #devfail, #error_context, error_location, error_location_with_space, error_location_with_unknowns, #exceptwrap, #fail

Methods included from Util

absolute_path?, benchmark, chuser, clear_environment, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, safe_posix_fork, set_env, symbolizehash, thinmark, uri_encode, uri_query_encode, uri_to_path, which, withenv, withumask

Methods included from Util::SymbolicFileMode

#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Methods included from Util::POSIX

#get_posix_field, #gid, groups_of, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Constructor Details

#initialize(name: nil, value: nil, source: nil, line: nil, file: nil, add: nil) ⇒ Param


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/puppet/parser/resource/param.rb', line 8

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

Instance Attribute Details

#addObject

Returns the value of attribute add


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def add
  @add
end

#fileObject

Returns the value of attribute file


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def file
  @file
end

#lineObject

Returns the value of attribute line


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def line
  @line
end

#nameObject

Returns the value of attribute name


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def name
  @name
end

#sourceObject

Returns the value of attribute source


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def source
  @source
end

#valueObject

Returns the value of attribute value


6
7
8
# File 'lib/puppet/parser/resource/param.rb', line 6

def value
  @value
end

Instance Method Details

#line_to_iObject


22
23
24
# File 'lib/puppet/parser/resource/param.rb', line 22

def line_to_i
  line ? Integer(line) : nil
end

#to_sObject


26
27
28
# File 'lib/puppet/parser/resource/param.rb', line 26

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