Class: Ruby::Pomodoro::Progressbar

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

Instance Method Summary collapse

Constructor Details

#initialize(seconds:, printer: Ruby::Pomodoro::Printer.new) ⇒ Progressbar

Returns a new instance of Progressbar.



4
5
6
7
8
# File 'lib/ruby/pomodoro/progressbar.rb', line 4

def initialize(seconds:, printer: Ruby::Pomodoro::Printer.new)
  @all_seconds = seconds
  @spent_seconds = 0
  @printer = printer
end

Instance Method Details

#incrementObject



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

def increment
  @spent_seconds += 1
  print
end

#start(text) ⇒ Object



10
11
12
# File 'lib/ruby/pomodoro/progressbar.rb', line 10

def start(text)
  @text = text
end