class Puppet::Settings::BooleanSetting

A simple boolean.

Public Instance Methods

getopt_args() click to toggle source

get the arguments in getopt format

# 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) click to toggle source
# File lib/puppet/settings/boolean_setting.rb, line 22
def munge(value)
  case value
  when true, "true"; return true
  when false, "false"; return false
  else
    raise Puppet::Settings::ValidationError, "Invalid value '#{value.inspect}' for boolean parameter: #{@name}"
  end
end
optparse_args() click to toggle source
# 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() click to toggle source
# File lib/puppet/settings/boolean_setting.rb, line 31
def type
  :boolean
end