Method: String#to_seconds

Defined in:
lib/wavefront-cli/stdlib/string.rb

#to_secondsObject



73
74
75
76
77
78
79
80
81
# File 'lib/wavefront-cli/stdlib/string.rb', line 73

def to_seconds
  begin
    number, unit = match(/^(\d+)([smhdw])$/).captures
  rescue NoMethodError
    raise ArgumentError
  end

  number.to_i * unit_factor(unit.to_sym)
end