Module WeatherReportLocation
In: lib/weather_report.rb

Module to load and provide accessors for shared location specific

Methods

Constants

TITLE = /(.+) for ([\w -\.]*), ([\w -\.]*)/

Attributes

country  [R] 
latitude  [R] 
longtitude  [R] 
name  [R] 

Public Instance methods

load the location based data (name, country, latitude, longtitude) from the backstage feed

[Source]

# File lib/weather_report.rb, line 76
  def loadLocation(xmlDoc)
    xmlDoc.elements.each("rss/channel/title") { |element| 
      md = TITLE.match(element.text)
      @name = md[2] if md 
      @country = md[3] if md 
    }
          
    xmlDoc.elements.each("rss/channel/item[1]/geo:lat") { |element| @latitude = element.text.to_f }
    xmlDoc.elements.each("rss/channel/item[1]/geo:long") { |element| @longtitude = element.text.to_f }
  end

[Validate]