Sha256: ba83a97c7448407be3e95ada38a6ecb3dcd2ffa3694b9ca3a75944542d2fe94e

Contents?: true

Size: 804 Bytes

Versions: 246

Compression:

Stored size: 804 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.inspect}' for boolean parameter: #{@name}"
    end
  end

  def type
    :boolean
  end
end

Version data entries

246 entries across 246 versions & 2 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/settings/boolean_setting.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/settings/boolean_setting.rb
puppet-4.10.12 lib/puppet/settings/boolean_setting.rb
puppet-4.10.12-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.12-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.12-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-4.10.11 lib/puppet/settings/boolean_setting.rb
puppet-4.10.11-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.11-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.11-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-4.10.10 lib/puppet/settings/boolean_setting.rb
puppet-4.10.10-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.10-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.10-universal-darwin lib/puppet/settings/boolean_setting.rb
puppet-retrospec-1.6.1 vendor/pup410/lib/puppet/settings/boolean_setting.rb
puppet-retrospec-1.6.0 vendor/pup410/lib/puppet/settings/boolean_setting.rb
puppet-4.10.9 lib/puppet/settings/boolean_setting.rb
puppet-4.10.9-x86-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.9-x64-mingw32 lib/puppet/settings/boolean_setting.rb
puppet-4.10.9-universal-darwin lib/puppet/settings/boolean_setting.rb