Class: Onebusaway::Stop
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#locationType ⇒ Object
Returns the value of attribute locationType.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#name ⇒ Object
Returns the value of attribute name.
-
#routes ⇒ Object
Returns the value of attribute routes.
Class Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def code @code end |
#direction ⇒ Object
Returns the value of attribute direction.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def direction @direction end |
#id ⇒ Object
Returns the value of attribute id.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def id @id end |
#lat ⇒ Object
Returns the value of attribute lat.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def lat @lat end |
#locationType ⇒ Object
Returns the value of attribute locationType.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def locationType @locationType end |
#lon ⇒ Object
Returns the value of attribute lon.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def lon @lon end |
#name ⇒ Object
Returns the value of attribute name.
166 167 168 |
# File 'lib/onebusaway.rb', line 166 def name @name end |
#routes ⇒ Object
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 |