class DWML::Location

Attributes

element[R]
latitude[R]
location_key[R]
longitude[R]

Public Class Methods

extract(elements) click to toggle source
# File lib/dwml/location.rb, line 4
def extract(elements)
  elements.map { |element| new(element) }
end
new(element) click to toggle source
# File lib/dwml/location.rb, line 11
def initialize(element)
  @element = element

  extract_key
  extract_coords
end

Protected Instance Methods

extract_coords() click to toggle source
# File lib/dwml/location.rb, line 24
def extract_coords
  point = element.xpath('point').first

  @latitude  = point.attributes["latitude"].text.to_f
  @longitude = point.attributes["longitude"].text.to_f
end
extract_key() click to toggle source
# File lib/dwml/location.rb, line 20
def extract_key
  @location_key = element.xpath("location-key").first.text
end