Class: TimexDatalinkClient::Protocol7::Eeprom::Calendar::Event
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol7::Eeprom::Calendar::Event
- Includes:
- Helpers::LsbMsbFormatter
- Defined in:
- lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb
Constant Summary collapse
- FIVE_MINUTES_SECONDS =
300
Instance Attribute Summary collapse
-
#phrase ⇒ Object
Returns the value of attribute phrase.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(time:, phrase:) ⇒ Event
constructor
Create an Event instance.
- #time_formatted(device_time) ⇒ Object
Methods included from Helpers::LsbMsbFormatter
Constructor Details
#initialize(time:, phrase:) ⇒ Event
Create an Event instance.
21 22 23 24 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb', line 21 def initialize(time:, phrase:) @time = time @phrase = phrase end |
Instance Attribute Details
#phrase ⇒ Object
Returns the value of attribute phrase.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb', line 14 def phrase @phrase end |
#time ⇒ Object
Returns the value of attribute time.
14 15 16 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb', line 14 def time @time end |
Instance Method Details
#time_formatted(device_time) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb', line 26 def time_formatted(device_time) device_time_midnight = Time.new(device_time.year, device_time.month, device_time.day) seconds = (time - device_time_midnight).to_i five_minutes = seconds / FIVE_MINUTES_SECONDS lsb_msb_format_for(five_minutes) end |