Class: Salus::Metric::Value

Inherits:
Struct
  • Object
show all
Defined in:
lib/salus/metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timestampObject

Returns the value of attribute timestamp

Returns:

  • (Object)

    the current value of timestamp



23
24
25
# File 'lib/salus/metric.rb', line 23

def timestamp
  @timestamp
end

#ttlObject

Returns the value of attribute ttl

Returns:

  • (Object)

    the current value of ttl



23
24
25
# File 'lib/salus/metric.rb', line 23

def ttl
  @ttl
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



23
24
25
# File 'lib/salus/metric.rb', line 23

def value
  @value
end

Instance Method Details

#expired?(ts = nil) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
# File 'lib/salus/metric.rb', line 24

def expired?(ts=nil)
  return false if ttl.nil?
  ts ||= Time.now.to_f
  ts > (timestamp + ttl)
end