Class: Puppet::Settings::BooleanSetting
- Inherits:
-
BaseSetting
- Object
- BaseSetting
- Puppet::Settings::BooleanSetting
- Defined in:
- lib/puppet/settings/boolean_setting.rb
Overview
A simple boolean.
Constant Summary
Constants inherited from BaseSetting
Puppet::Settings::BaseSetting::HOOK_TYPES
Instance Attribute Summary
Attributes inherited from BaseSetting
#call_hook, #default, #deprecated, #desc, #name, #section, #short
Instance Method Summary collapse
-
#getopt_args ⇒ Object
get the arguments in getopt format.
- #munge(value) ⇒ Object
- #optparse_args ⇒ Object
- #type ⇒ Object
Methods inherited from BaseSetting
#allowed_on_commandline?, available_call_hook_values, #call_hook_on_define?, #call_hook_on_initialize?, #completely_deprecated?, #deprecated?, #has_hook?, #hook=, #initialize, #inspect, #iscreated, #iscreated?, #print, #set_meta, #to_config, #value
Constructor Details
This class inherits a constructor from Puppet::Settings::BaseSetting
Instance Method Details
#getopt_args ⇒ Object
get the arguments in getopt format
6 7 8 9 10 11 12 |
# File 'lib/puppet/settings/boolean_setting.rb', line 6 def getopt_args if short [["--#{name}", "-#{short}", GetoptLong::NO_ARGUMENT], ["--no-#{name}", GetoptLong::NO_ARGUMENT]] else [["--#{name}", GetoptLong::NO_ARGUMENT], ["--no-#{name}", GetoptLong::NO_ARGUMENT]] end end |
#munge(value) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/puppet/settings/boolean_setting.rb', line 22 def munge(value) case value when true, "true"; true when false, "false"; false else raise Puppet::Settings::ValidationError, _("Invalid value '%{value}' for boolean parameter: %{name}") % { value: value.inspect, name: @name } end end |
#optparse_args ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/puppet/settings/boolean_setting.rb', line 14 def optparse_args if short ["--[no-]#{name}", "-#{short}", desc, :NONE] else ["--[no-]#{name}", desc, :NONE] end end |
#type ⇒ Object
31 32 33 |
# File 'lib/puppet/settings/boolean_setting.rb', line 31 def type :boolean end |