Class: TTC::Stop
- Inherits:
-
Object
- Object
- TTC::Stop
- Defined in:
- lib/ttc-gps/models.rb
Overview
<stop lon=‘-79.5407149’ title=‘Lake Shore Blvd W At 39th’ tag=‘lake39th_e’ dirTag=‘501_eastbound’ stopId=‘6503’ lat=‘43.5928211’/>
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#id ⇒ Object
Returns the value of attribute id.
-
#position ⇒ Object
Returns the value of attribute position.
-
#route_id ⇒ Object
Returns the value of attribute route_id.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.parse_element(element) ⇒ Object
Parses an XML element into a Stop instance.
Instance Method Summary collapse
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def dir @dir end |
#id ⇒ Object
Returns the value of attribute id.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def id @id end |
#position ⇒ Object
Returns the value of attribute position.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def position @position end |
#route_id ⇒ Object
Returns the value of attribute route_id.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def route_id @route_id end |
#tag ⇒ Object
Returns the value of attribute tag.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def tag @tag end |
#title ⇒ Object
Returns the value of attribute title.
130 131 132 |
# File 'lib/ttc-gps/models.rb', line 130 def title @title end |
Class Method Details
.parse_element(element) ⇒ Object
Parses an XML element into a Stop instance
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/ttc-gps/models.rb', line 144 def Stop.parse_element element attrs = element.attributes s = Stop.new s.id = attrs["stopId"] s.title = attrs["title"] s.position = Geokit::LatLng.new(Float(attrs["lat"]), Float(attrs["lon"])) s.dir = attrs["dirTag"] s.tag = attrs["tag"] s end |
Instance Method Details
#to_json(*args) ⇒ Object
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/ttc-gps/models.rb', line 132 def to_json *args { 'id' => @id, 'title' => @title, 'position' => @position, 'dir' => @dir, 'tag' => @tag, 'routeId' => @route_id }.to_json(*args) end |