Module: LIFX::LAN::Seen
- Included in:
- Light
- Defined in:
- lib/lifx/lan/seen.rb
Instance Method Summary collapse
-
#last_seen ⇒ Time
Returns the time when the device was last seen.
-
#seconds_since_seen ⇒ Float
Returns the number of seconds since the device was last seen.
Instance Method Details
#last_seen ⇒ Time
Returns the time when the device was last seen.
6 7 8 |
# File 'lib/lifx/lan/seen.rb', line 6 def last_seen @last_seen end |
#seconds_since_seen ⇒ Float
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.
14 15 16 |
# File 'lib/lifx/lan/seen.rb', line 14 def seconds_since_seen Time.now - (last_seen || Time.at(0)) end |