Class: AocCli::Progress
- Inherits:
-
Kangaru::Model
- Object
- Kangaru::Model
- AocCli::Progress
- Defined in:
- lib/aoc_cli/models/progress.rb
Instance Method Summary collapse
- #complete! ⇒ Object
- #complete? ⇒ Boolean
- #incomplete? ⇒ Boolean
- #reset! ⇒ Object
- #time_taken ⇒ Object
Instance Method Details
#complete! ⇒ Object
17 18 19 |
# File 'lib/aoc_cli/models/progress.rb', line 17 def complete! update(completed_at: Time.now) end |
#complete? ⇒ Boolean
9 10 11 |
# File 'lib/aoc_cli/models/progress.rb', line 9 def complete? !incomplete? end |
#incomplete? ⇒ Boolean
13 14 15 |
# File 'lib/aoc_cli/models/progress.rb', line 13 def incomplete? completed_at.nil? end |
#reset! ⇒ Object
21 22 23 |
# File 'lib/aoc_cli/models/progress.rb', line 21 def reset! update(started_at: Time.now) end |
#time_taken ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/aoc_cli/models/progress.rb', line 25 def time_taken if complete? completed_at - started_at else Time.now - started_at end end |