Class: LogStash::Setting::TimeValue

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

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) ⇒ TimeValue

Returns a new instance of TimeValue.



552
553
554
# File 'lib/logstash/settings.rb', line 552

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

Instance Method Details

#coerce(value) ⇒ Object



556
557
558
559
# File 'lib/logstash/settings.rb', line 556

def coerce(value)
  return value if value.is_a?(::Integer)
  Util::TimeValue.from_value(value).to_nanos
end