Sha256: 5c76bcf926c3fec1539ae044898c0ca05a7778c0818ca62bc08babe3a1904875

Contents?: true

Size: 844 Bytes

Versions: 25

Compression:

Stored size: 844 Bytes

Contents

require 'puppet/settings/base_setting'

# 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

25 entries across 25 versions & 2 rubygems

Version Path
puppet-3.2.4 lib/puppet/settings/boolean_setting.rb
puppet-3.2.3 lib/puppet/settings/boolean_setting.rb
puppet-3.2.3.rc1 lib/puppet/settings/boolean_setting.rb
puppet-3.2.2 lib/puppet/settings/boolean_setting.rb
puppet-3.2.1 lib/puppet/settings/boolean_setting.rb
puppet-3.2.1.rc1 lib/puppet/settings/boolean_setting.rb
puppet-3.2.0.rc2 lib/puppet/settings/boolean_setting.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/settings/boolean_setting.rb
puppet-3.2.0.rc1 lib/puppet/settings/boolean_setting.rb
puppet-3.1.1 lib/puppet/settings/boolean_setting.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/settings/boolean_setting.rb
puppet-3.1.0 lib/puppet/settings/boolean_setting.rb
puppet-3.1.0.rc2 lib/puppet/settings/boolean_setting.rb
puppet-3.1.0.rc1 lib/puppet/settings/boolean_setting.rb
puppet-3.0.2 lib/puppet/settings/boolean_setting.rb
puppet-3.0.2.rc3 lib/puppet/settings/boolean_setting.rb
puppet-3.0.2.rc2 lib/puppet/settings/boolean_setting.rb
puppet-3.0.2.rc1 lib/puppet/settings/boolean_setting.rb
puppet-3.0.1 lib/puppet/settings/boolean_setting.rb
puppet-3.0.1.rc1 lib/puppet/settings/boolean_setting.rb