Class: Ruby::Pomodoro::Tasks::Entity
- Inherits:
-
Object
- Object
- Ruby::Pomodoro::Tasks::Entity
- Defined in:
- lib/ruby/pomodoro/tasks/entity.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#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, id: nil) ⇒ Entity
constructor
A new instance of Entity.
- #track(seconds) ⇒ Integer
Constructor Details
#initialize(name:, spent_time: 0, id: nil) ⇒ Entity
Returns a new instance of Entity.
7 8 9 10 11 12 |
# File 'lib/ruby/pomodoro/tasks/entity.rb', line 7 def initialize(name:, spent_time: 0, id: nil) @name = name @spent_time = spent_time @pomodors = 0 @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/ruby/pomodoro/tasks/entity.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/ruby/pomodoro/tasks/entity.rb', line 5 def name @name end |
#pomodors ⇒ Object (readonly)
Returns the value of attribute pomodors.
5 6 7 |
# File 'lib/ruby/pomodoro/tasks/entity.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/tasks/entity.rb', line 5 def spent_time @spent_time end |
Instance Method Details
#add_pomodoro ⇒ Integer
15 16 17 |
# File 'lib/ruby/pomodoro/tasks/entity.rb', line 15 def add_pomodoro @pomodors += 1 end |
#track(seconds) ⇒ Integer
21 22 23 |
# File 'lib/ruby/pomodoro/tasks/entity.rb', line 21 def track(seconds) @spent_time += seconds end |