class SecondsCalculator
Also accepts any argument processable by Time#parse
Public Class Methods
new(time_string)
click to toggle source
Calls superclass method
# File lib/puma/clocker/seconds_calculator.rb, line 18 def initialize(time_string) super(time_string) find_start_time find_time_taken make_presentable end
run(time_string)
click to toggle source
# File lib/puma/clocker/seconds_calculator.rb, line 10 def run(time_string) puts(new(time_string)) if time_string end
Private Instance Methods
current_time()
click to toggle source
# File lib/puma/clocker/seconds_calculator.rb, line 33 def current_time Time.new end
find_start_time()
click to toggle source
# File lib/puma/clocker/seconds_calculator.rb, line 25 def find_start_time @start_time = Time.parse(self) end
find_time_taken()
click to toggle source
# File lib/puma/clocker/seconds_calculator.rb, line 29 def find_time_taken @time_taken = current_time - @start_time end
make_presentable()
click to toggle source
# File lib/puma/clocker/seconds_calculator.rb, line 37 def make_presentable self.gsub!(/^.*$/, "Started server in #{@time_taken} seconds.") end