Module: LIFX::Seen

Included in:
Light
Defined in:
lib/lifx/seen.rb

Instance Method Summary collapse

Instance Method Details

#last_seenTime

Returns the time when the device was last seen.

Returns:

  • (Time)


5
6
7
# File 'lib/lifx/seen.rb', line 5

def last_seen
  @last_seen
end

#seconds_since_seenFloat

Returns the number of seconds since the device was last seen. If the device hasn't been seen yet, it will use Unix epoch as the time it was seen.

Returns:

  • (Float)


13
14
15
# File 'lib/lifx/seen.rb', line 13

def seconds_since_seen
  Time.now - (last_seen || Time.at(0))
end