Sha256: 479ef9ac3dead1ad97875d63e9a28894a46875092c73621c3c5e8f30e23b89b2

Contents?: true

Size: 838 Bytes

Versions: 515

Compression:

Stored size: 838 Bytes

Contents

# A simple boolean.
class Puppet::Settings::BooleanSetting < Puppet::Settings::BaseSetting
  # get the arguments in getopt format
  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

  def optparse_args
    if short
      ["--[no-]#{name}", "-#{short}", desc, :NONE ]
    else
      ["--[no-]#{name}", desc, :NONE]
    end
  end

  def munge(value)
    case value
    when true, "true"; return true
    when false, "false"; return false
    else
      raise Puppet::Settings::ValidationError, _("Invalid value '%{value}' for boolean parameter: %{name}") % { value: value.inspect, name: @name }
    end
  end

  def type
    :boolean
  end
end

Version data entries

515 entries across 515 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/settings/boolean_setting.rb
puppet-7.34.0-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.34.0-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.34.0-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-7.33.0 lib/puppet/settings/boolean_setting.rb
puppet-7.33.0-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.33.0-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.33.0-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-7.32.1 lib/puppet/settings/boolean_setting.rb
puppet-7.32.1-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.32.1-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.32.1-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-7.31.0 lib/puppet/settings/boolean_setting.rb
puppet-7.31.0-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.31.0-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.31.0-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-7.30.0 lib/puppet/settings/boolean_setting.rb
puppet-7.30.0-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.30.0-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-7.30.0-universal-darwin lib/puppet/settings/boolean_setting.rb