class Ruby::Pomodoro::Progressbar
Public Class Methods
new(seconds:, printer: Ruby::Pomodoro::Printer.new)
click to toggle source
# 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
Public Instance Methods
increment()
click to toggle source
# File lib/ruby/pomodoro/progressbar.rb, line 14 def increment @spent_seconds += 1 print end
start(text)
click to toggle source
# File lib/ruby/pomodoro/progressbar.rb, line 10 def start(text) @text = text end
Private Instance Methods
print()
click to toggle source
# File lib/ruby/pomodoro/progressbar.rb, line 21 def print @printer.print " In progress: #{@text} [#{strftime}]\r", color: :green end
strftime()
click to toggle source
# File lib/ruby/pomodoro/progressbar.rb, line 25 def strftime seconds = @all_seconds - @spent_seconds minutes = seconds / 60 "#{minutes} m #{seconds - minutes * 60} s" end