class Weather::Utils

Public Class Methods

parse_time(text = '') click to toggle source

Attempts to convert passed text into a Time object

Returns a Time object or nil

# File lib/weather-api/utils.rb, line 9
def self.parse_time(text = '')
  if text == ''
    return nil
  end

  begin
    Time.parse text
  rescue ArgumentError
    Chronic.parse text
  end
end