Class: Weather::Forecast::CurrentConditions
- Inherits:
-
Conditions
- Object
- Conditions
- Weather::Forecast::CurrentConditions
- Defined in:
- lib/weather/forecast.rb
Overview
Represents the current weather conditions.
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #date ⇒ Object
-
#icon ⇒ Object
The numeric ID for the icon representing current conditions.
-
#initialize(element) ⇒ CurrentConditions
constructor
A new instance of CurrentConditions.
- #outlook ⇒ Object
- #outlook_brief ⇒ Object
- #pop ⇒ Object (also: #ppcp)
- #temp ⇒ Object (also: #tmp, #temperature)
Methods inherited from Conditions
#latest_update, #method_missing, #wind
Constructor Details
#initialize(element) ⇒ CurrentConditions
Returns a new instance of CurrentConditions.
225 226 227 228 229 230 |
# File 'lib/weather/forecast.rb', line 225 def initialize(element) if (not element.kind_of?($USE_LIBXML ? XML::Node : REXML::Element)) raise "The xml element given to the Day/Night constructor must be a valid REXML::Element or XML::Node" end @xml = element end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Weather::Forecast::Conditions
Instance Attribute Details
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
221 222 223 |
# File 'lib/weather/forecast.rb', line 221 def xml @xml end |
Instance Method Details
#date ⇒ Object
257 258 259 |
# File 'lib/weather/forecast.rb', line 257 def date Time.now end |
#icon ⇒ Object
The numeric ID for the icon representing current conditions. You can find the corresponding icons packaged with RubyWeather in the example/weather_32 directory.
234 235 236 |
# File 'lib/weather/forecast.rb', line 234 def icon xml.elements['icon'].text.to_i end |
#outlook ⇒ Object
244 245 246 |
# File 'lib/weather/forecast.rb', line 244 def outlook xml.elements['t'].text end |
#outlook_brief ⇒ Object
248 249 250 |
# File 'lib/weather/forecast.rb', line 248 def outlook_brief xml.elements['bt'].text end |
#pop ⇒ Object Also known as: ppcp
252 253 254 |
# File 'lib/weather/forecast.rb', line 252 def pop nil end |
#temp ⇒ Object Also known as: tmp, temperature
238 239 240 |
# File 'lib/weather/forecast.rb', line 238 def temp clean_temp('tmp') end |