class MassHighways::Pair
Attributes
destination[RW]
direction[RW]
freeflow[RW]
origin[RW]
pair_id[RW]
route[RW]
speed[RW]
stale[RW]
status[RW]
title[RW]
travel_time[RW]
Public Class Methods
new()
click to toggle source
# File lib/mass_highways/pair.rb, line 6 def initialize @route = [] end
parse(node)
click to toggle source
# File lib/mass_highways/pair.rb, line 10 def self.parse(node) pair = self.new pair.pair_id = node.search('PairID').first.text.to_i pair.title = node.search('Title').first.text pair.direction = node.search('Direction').first.text pair.origin = node.search('Origin').first.text pair.destination = node.search('Destination').first.text pair.speed = node.search('Speed').first.text.to_f pair.travel_time = node.search('TravelTime').first.text.to_f pair.freeflow = node.search('FreeFlow').first.text.to_f node.search('Routes Route').each do |route_node| lat = route_node.search('lat').first.text.to_f lon = route_node.search('lon').first.text.to_f pair.route << { lat: lat, lon: lon } end pair end