Class: Onebusaway::Stop

Inherits:
Base
  • Object
show all
Defined in:
lib/onebusaway.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

from_xml

Instance Attribute Details

#codeObject

Returns the value of attribute code.



166
167
168
# File 'lib/onebusaway.rb', line 166

def code
  @code
end

#directionObject

Returns the value of attribute direction.



166
167
168
# File 'lib/onebusaway.rb', line 166

def direction
  @direction
end

#idObject

Returns the value of attribute id.



166
167
168
# File 'lib/onebusaway.rb', line 166

def id
  @id
end

#latObject

Returns the value of attribute lat.



166
167
168
# File 'lib/onebusaway.rb', line 166

def lat
  @lat
end

#locationTypeObject

Returns the value of attribute locationType.



166
167
168
# File 'lib/onebusaway.rb', line 166

def locationType
  @locationType
end

#lonObject

Returns the value of attribute lon.



166
167
168
# File 'lib/onebusaway.rb', line 166

def lon
  @lon
end

#nameObject

Returns the value of attribute name.



166
167
168
# File 'lib/onebusaway.rb', line 166

def name
  @name
end

#routesObject

Returns the value of attribute routes.



166
167
168
# File 'lib/onebusaway.rb', line 166

def routes
  @routes
end

Class Method Details

.parse(data) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/onebusaway.rb', line 167

def self.parse(data)
  stop = self.new
  [:id, :lat, :lon, :direction, :name, :code, :locationType].each do |attr|
    value = data.elements[attr.to_s]
    stop.send("#{attr}=", value.text) if value
  end
  stop.routes ||= []
  data.elements.each("routes/route") do |route_el|
    stop.routes << Route.parse(route_el)
  end
  stop
end