module Time::Elapsed

Constants

VERSION

Public Class Methods

time(time_str) click to toggle source

@param [String] time_str time string to be parsed @return [Fixnum] time_str in seconds

# File lib/time/elapsed.rb, line 16
def self.time(time_str)
  not_zero Parser.parse_time_str(time_str)
end

Private Class Methods

not_zero(i) click to toggle source

Allows number Strings or Fixnums Raise ArgumentError unless the number is not zero

always returns Integer
# File lib/time/elapsed.rb, line 24
def self.not_zero(i)
  i_dup = i.to_i #not really a dup since Fixnum is immutable
  if i_dup.zero?
    raise ArgumentError, 'Elapsed time not parsable'
  else
    return i_dup
  end
end