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

Methods included from Util::Loggable

included, #logger, #slow_logger

Constructor Details

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

Returns a new instance of TimeValue.



483
484
485
# File 'lib/logstash/settings.rb', line 483

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

Instance Method Details

#coerce(value) ⇒ Object



487
488
489
490
# File 'lib/logstash/settings.rb', line 487

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