Module: OpenWeather::Utilities
- Defined in:
- lib/OpenWeather/utilities.rb
Overview
Utility functions.
Instance Method Summary collapse
Instance Method Details
#city_name_from_file ⇒ Object
17 18 19 |
# File 'lib/OpenWeather/utilities.rb', line 17 def city_name_from_file @city_file.nil? ? "" : JSON.parse(File.read @city_file)['city']['name'] end |
#city_name_from_id(id) ⇒ Object
21 22 23 24 |
# File 'lib/OpenWeather/utilities.rb', line 21 def city_name_from_id(id) weather = weather_raw id weather['name'] end |
#today ⇒ Object
7 8 9 10 |
# File 'lib/OpenWeather/utilities.rb', line 7 def today time = Time.new time.strftime("%Y-%m-%d") end |
#tomorrow ⇒ Object
12 13 14 15 |
# File 'lib/OpenWeather/utilities.rb', line 12 def tomorrow time = Time.now + (60 * 60 * 24) time.strftime("%Y-%m-%d") end |