Class: Cinch::Plugins::Weatherman::Forecast
- Inherits:
-
Object
- Object
- Cinch::Plugins::Weatherman::Forecast
- Defined in:
- lib/cinch/plugins/weatherman/forecast.rb
Overview
Class to manage information on future conditions
Instance Method Summary collapse
- #append ⇒ Object
-
#initialize(location) ⇒ Forecast
constructor
A new instance of Forecast.
- #to_s ⇒ Object
Constructor Details
#initialize(location) ⇒ Forecast
Returns a new instance of Forecast.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cinch/plugins/weatherman/forecast.rb', line 7 def initialize(location) @data = WeatherUnderground::Base.new.SimpleForecast(location).days[1] fail ArgumentError if @data.nil? @location = Weather.new(location).location @forecast = @data.conditions.downcase @temp_high = @data.high.fahrenheit.round @temp_low = @data.low.fahrenheit.round end |
Instance Method Details
#append ⇒ Object
23 24 25 |
# File 'lib/cinch/plugins/weatherman/forecast.rb', line 23 def append to_s.gsub(" in #{@location}", '') end |
#to_s ⇒ Object
18 19 20 21 |
# File 'lib/cinch/plugins/weatherman/forecast.rb', line 18 def to_s "Tommorrow in #{@location}; #{@forecast}, " \ "high of #{@temp_high}F, low of #{@temp_low}F." end |