Class: Ruby::Pomodoro::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/pomodoro/task.rb

Overview

Task for [Ruby::Pomodoro::Worker]

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/ruby/pomodoro/task.rb', line 5

def name
  @name
end

#pomodorsObject (readonly)

Returns the value of attribute pomodors.



5
6
7
# File 'lib/ruby/pomodoro/task.rb', line 5

def pomodors
  @pomodors
end

#spent_timeObject (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_pomodoroInteger

Returns:

  • (Integer)


14
15
16
# File 'lib/ruby/pomodoro/task.rb', line 14

def add_pomodoro
  @pomodors += 1
end

#track(seconds) ⇒ Integer

Parameters:

  • seconds (Integer)

Returns:

  • (Integer)


20
21
22
# File 'lib/ruby/pomodoro/task.rb', line 20

def track(seconds)
  @spent_time += seconds
end