Class: LogStash::Setting::Boolean

Inherits:
Coercible show all
Defined in:
lib/logstash/settings.rb

Overview

Specific settings #####

Instance Attribute Summary

Attributes inherited from LogStash::Setting

#default, #name

Instance Method Summary collapse

Methods inherited from Coercible

#set

Methods inherited from LogStash::Setting

#==, #reset, #set, #set?, #strict?, #to_hash, #validate_value, #value

Constructor Details

#initialize(name, default, strict = true, &validator_proc) ⇒ Boolean

Returns a new instance of Boolean.



278
279
280
# File 'lib/logstash/settings.rb', line 278

def initialize(name, default, strict=true, &validator_proc)
  super(name, Object, default, strict, &validator_proc)
end

Instance Method Details

#coerce(value) ⇒ Object



282
283
284
285
286
287
288
289
290
291
# File 'lib/logstash/settings.rb', line 282

def coerce(value)
  case value
  when TrueClass, "true"
    true
  when FalseClass, "false"
    false
  else
    raise ArgumentError.new("could not coerce #{value} into a boolean")
  end
end