class Ke::MultiLineReporter
Public Class Methods
new(task, label, io = STDOUT)
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 3 def initialize(task, label, io = STDOUT) @task = task @label = label @io = io end
Public Instance Methods
print_complete()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 17 def print_complete @io.puts "Completed #{@label}, #{@task.total_duration} total duration" end
print_start()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 9 def print_start @io.puts "Starting #{@label}" end
print_tick()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 13 def print_tick @io.puts "#{prefix}#{infix}#{suffix}" end
Private Instance Methods
infix()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 28 def infix if @task.respond_to?(:estimated_duration_until_complete) estimated_duration_until_complete = (@task.estimated_duration_until_complete / 60.0).round(2) ", #{estimated_duration_until_complete} minutes remaining" else ticks_per_second = (1.0 / @task.duration_per_tick).round(2) ", #{ticks_per_second} ticks/second" end end
prefix()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 23 def prefix elapsed_time = (@task.elapsed_duration / 60.0).round(2) "Running #{@label}, #{elapsed_time} minutes elapsed" end
suffix()
click to toggle source
# File lib/ke/reporters/multi_line_reporter.rb, line 38 def suffix if @task.respond_to?(:total_ticks) pct = (@task.tick_count.to_f * 100 / @task.total_ticks).round(2) ", #{@task.tick_count}/#{@task.total_ticks} ticks ~ #{pct}% complete" end end