Method: Puppet::Settings::PrioritySetting#munge

Defined in:
lib/puppet/settings/priority_setting.rb

#munge(value) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/puppet/settings/priority_setting.rb', line 28

def munge(value)
  return unless value

  case
  when value.is_a?(Integer)
    value
  when (value.is_a?(String) and value =~ /\d+/)
    value.to_i
  when (value.is_a?(String) and PRIORITY_MAP[value.to_sym])
    PRIORITY_MAP[value.to_sym]
  else
    raise Puppet::Settings::ValidationError, _("Invalid priority format '%{value}' for parameter: %{name}") % { value: value.inspect, name: @name }
  end
end