Class: Weather::Utils
- Inherits:
-
Object
- Object
- Weather::Utils
- Defined in:
- lib/weather-api/utils.rb
Class Method Summary collapse
-
.parse_time(text = '') ⇒ Object
Attempts to convert passed text into a Time object.
Class Method Details
.parse_time(text = '') ⇒ Object
Attempts to convert passed text into a Time object
Returns a Time object or nil
9 10 11 12 13 14 15 16 17 18 19 |
# 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 |