Class: Ruby::Pomodoro::Task
- Inherits:
-
Object
- Object
- Ruby::Pomodoro::Task
- Defined in:
- lib/ruby/pomodoro/task.rb
Overview
Task for [Ruby::Pomodoro::Worker]
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pomodors ⇒ Object
readonly
Returns the value of attribute pomodors.
-
#spent_time ⇒ Object
readonly
Returns the value of attribute spent_time.
Instance Method Summary collapse
- #add_pomodoro ⇒ Integer
-
#initialize(name, spent_time: 0) ⇒ Task
constructor
A new instance of Task.
- #track(seconds) ⇒ Integer
Constructor Details
#initialize(name, spent_time: 0) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 |
# File 'lib/ruby/pomodoro/task.rb', line 7 def initialize(name, spent_time: 0) @name = name @spent_time = spent_time @pomodors = 0 end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/ruby/pomodoro/task.rb', line 5 def name @name end |
#pomodors ⇒ Object (readonly)
Returns the value of attribute pomodors.
5 6 7 |
# File 'lib/ruby/pomodoro/task.rb', line 5 def pomodors @pomodors end |
#spent_time ⇒ Object (readonly)
Returns the value of attribute spent_time.
5 6 7 |
# File 'lib/ruby/pomodoro/task.rb', line 5 def spent_time @spent_time end |
Instance Method Details
#add_pomodoro ⇒ Integer
14 15 16 |
# File 'lib/ruby/pomodoro/task.rb', line 14 def add_pomodoro @pomodors += 1 end |
#track(seconds) ⇒ Integer
20 21 22 |
# File 'lib/ruby/pomodoro/task.rb', line 20 def track(seconds) @spent_time += seconds end |