lib/shelltastic/timer.rb in shelltastic-0.2.5 vs lib/shelltastic/timer.rb in shelltastic-0.3.0
- old
+ new
@@ -1,32 +1,34 @@
module ShellTastic
- module Timer
- class << self
+ class Timer
+ def initialize
+
+ end
+
# Creates a start time object
# @param [nil]
# @return [Time] Time now object
def start
- @start = Time.now
+ @start_time = Time.now
end
# Creates a stop time object
# @param [nil]
# @return [Time] Time now object
def stop
- @stop = Time.now
+ @stop_time = Time.now
end
# Calculates the total time elapsed
# @see #start and #stop
# @param [Hash, nil] opts the opts passed in
# @option [Boolean] milliseconds the time in milliseconds
# @return [Time] Time elapsed between #start and #stop
def total_time(milliseconds = false)
if milliseconds
- (@stop - @start) * 1000.0
+ (@stop_time - @start_time) * 1000.0
else
- @stop - @start
+ @stop_time - @start_time
end
end
end
end
-end