class Pandocomatic::FinishPrinter

Printer for the end of the conversion process in non-quiet mode

Constants

MINUTE

A minute has 60 seconds

Public Class Methods

new(command, configuration, start_time) click to toggle source

Create a new FinishPrinter

@param command [Command] the command to finish @param configuration [Configuration] the configuration of the pandocomatic invokation @param start_time [Time] the time the command was started

Calls superclass method
# File lib/pandocomatic/printer/finish_printer.rb, line 35
def initialize(command, configuration, start_time)
  super(command, configuration)
  template 'finish.txt'

  @start_time = start_time
  @end_time = Time.now
end

Public Instance Methods

duration() click to toggle source

Calculate the duration of the whole conversion process

@return [Number]

# File lib/pandocomatic/printer/finish_printer.rb, line 46
def duration
  seconds = @end_time - @start_time
  if seconds > MINUTE
    minutes = (seconds / MINUTE).floor
    seconds -= (minutes * MINUTE)
    "#{minutes} minute#{'s' if minutes != 1} and #{seconds.round(1)} second#{'s' if seconds != 1}"
  else
    "#{seconds.round(1)} second#{'s' if seconds != 1}"
  end
end