Class: Kronos::Task
- Inherits:
-
Object
- Object
- Kronos::Task
- Defined in:
- lib/kronos/task.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id, timestamp, block) ⇒ Task
constructor
A new instance of Task.
- #time ⇒ Object
Constructor Details
#initialize(id, timestamp, block) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 12 |
# File 'lib/kronos/task.rb', line 7 def initialize(id, , block) @id = check_id(id) @timestamp = time # check timestamp parseability @block = check_block(block) end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/kronos/task.rb', line 5 def block @block end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/kronos/task.rb', line 5 def id @id end |
Instance Method Details
#time ⇒ Object
14 15 16 17 18 |
# File 'lib/kronos/task.rb', line 14 def time Chronic.parse(@timestamp) || raise_unrecognized_time_format rescue StandardError raise_unrecognized_time_format end |