Module: Puppet::Parser::Util::InstanceMethods

Included in:
Array, Config, Hash
Defined in:
lib/puppet/parser/util/erly.rb

Instance Method Summary collapse

Instance Method Details

#convert(value) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/puppet/parser/util/erly.rb', line 3

def convert(value)
  case value
  when ::String
    if value =~ /^[0-9]+$/ then
      ::Puppet::Parser::Util::Value.new(Integer(value))
    else
      ::Puppet::Parser::Util::String.new(value)
    end
  when ::Array
    ::Puppet::Parser::Util::Array.new(value)
  when ::Hash
    ::Puppet::Parser::Util::Hash.new(value)
  when ::TrueClass
    ::Puppet::Parser::Util::Value.new("true")
  when ::FalseClass
    ::Puppet::Parser::Util::Value.new("false")
  when ::NilClass
    ::Puppet::Parser::Util::Value.new("null")
  else
    ::Puppet::Parser::Util::Value.new(value)
  end
end

#indent(level) ⇒ Object



26
27
28
# File 'lib/puppet/parser/util/erly.rb', line 26

def indent(level)
  "\t" * level
end