Class: Weather::Forecast::CurrentConditions

Inherits:
Conditions
  • Object
show all
Defined in:
lib/weather/forecast.rb

Overview

Represents the current weather conditions.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#xmlObject (readonly)

Returns the value of attribute xml.



221
222
223
# File 'lib/weather/forecast.rb', line 221

def xml
  @xml
end

Instance Method Details

#dateObject



257
258
259
# File 'lib/weather/forecast.rb', line 257

def date
  Time.now
end

#iconObject

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

#outlookObject



244
245
246
# File 'lib/weather/forecast.rb', line 244

def outlook
  xml.elements['t'].text
end

#outlook_briefObject



248
249
250
# File 'lib/weather/forecast.rb', line 248

def outlook_brief
  xml.elements['bt'].text
end

#popObject Also known as: ppcp



252
253
254
# File 'lib/weather/forecast.rb', line 252

def pop
  nil
end

#tempObject Also known as: tmp, temperature



238
239
240
# File 'lib/weather/forecast.rb', line 238

def temp
  clean_temp('tmp')
end