Class: Puppet::Settings::SymbolicEnumSetting
- Inherits:
-
BaseSetting
- Object
- BaseSetting
- Puppet::Settings::SymbolicEnumSetting
- Defined in:
- lib/puppet/settings/symbolic_enum_setting.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
Returns the value of attribute values.
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, #set_meta, #to_config, #value
Constructor Details
This class inherits a constructor from Puppet::Settings::BaseSetting
Instance Attribute Details
#values ⇒ Object
Returns the value of attribute values.
2 3 4 |
# File 'lib/puppet/settings/symbolic_enum_setting.rb', line 2 def values @values end |
Instance Method Details
#munge(value) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/puppet/settings/symbolic_enum_setting.rb', line 8 def munge(value) sym = value.to_sym if values.include?(sym) sym else raise Puppet::Settings::ValidationError, _("Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'") % { value: value, name: @name, allowed_values: values.join("', '") } end end |
#type ⇒ Object
4 5 6 |
# File 'lib/puppet/settings/symbolic_enum_setting.rb', line 4 def type :symbolic_enum end |