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.



510
511
512
# File 'lib/logstash/settings.rb', line 510

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

Instance Method Details

#coerce(value) ⇒ Object



514
515
516
517
# File 'lib/logstash/settings.rb', line 514

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