class Pompous
MIT license, copyright daniel lissner (speakingcode.com) 2013
Public Instance Methods
cls()
click to toggle source
# File lib/pompous.rb, line 21 def cls if $stdout.isatty print "\e[2J\e[f" else system('clear') end end
countdown(message, minutes)
click to toggle source
# File lib/pompous.rb, line 11 def countdown message, minutes end_time = Time.now + (60 * minutes) while (Time.now < end_time) print "\r#{message}: #{((end_time - Time.now) / 60).floor}:#{((end_time - Time.now) % 60).floor.to_s.rjust(2,'0')}" sleep 1 STDOUT.flush end end
pomodoro()
click to toggle source
# File lib/pompous.rb, line 4 def pomodoro cls 3.times { countdown 'work', 25; countdown 'break', 5 } countdown 'work', 25; countdown 'break', 15; end