Class: Puppet::Settings::IntegerSetting

Inherits:
BaseSetting show all
Defined in:
lib/puppet/settings/integer_setting.rb

Direct Known Subclasses

PortSetting

Constant Summary

Constants inherited from BaseSetting

BaseSetting::HOOK_TYPES

Instance Attribute Summary

Attributes inherited from BaseSetting

#call_hook, #default, #deprecated, #desc, #name, #section, #short

Instance Method Summary collapse

Methods inherited from BaseSetting

#allowed_on_commandline?, available_call_hook_values, #call_hook_on_define?, #call_hook_on_initialize?, #completely_deprecated?, #deprecated?, #getopt_args, #has_hook?, #hook=, #initialize, #inspect, #iscreated, #iscreated?, #optparse_args, #print, #set_meta, #to_config, #value

Constructor Details

This class inherits a constructor from Puppet::Settings::BaseSetting

Instance Method Details

#munge(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/puppet/settings/integer_setting.rb', line 4

def munge(value)
  return value if value.is_a?(Integer)

  begin
    value = Integer(value)
  rescue ArgumentError, TypeError
    raise Puppet::Settings::ValidationError, _("Cannot convert '%{value}' to an integer for parameter: %{name}") % { value: value.inspect, name: @name }
  end

  value
end

#typeObject



16
17
18
# File 'lib/puppet/settings/integer_setting.rb', line 16

def type
  :integer
end