Class: Bort::Station::Station
- Inherits:
-
Object
- Object
- Bort::Station::Station
- Defined in:
- lib/bort/station.rb
Instance Attribute Summary collapse
-
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
-
#address ⇒ Object
Returns the value of attribute address.
-
#attraction ⇒ Object
Returns the value of attribute attraction.
-
#bike_flag ⇒ Object
Returns the value of attribute bike_flag.
-
#bike_station_flag ⇒ Object
Returns the value of attribute bike_station_flag.
-
#bike_station_text ⇒ Object
Returns the value of attribute bike_station_text.
-
#car_share ⇒ Object
Returns the value of attribute car_share.
-
#city ⇒ Object
Returns the value of attribute city.
-
#county ⇒ Object
Returns the value of attribute county.
-
#cross_street ⇒ Object
Returns the value of attribute cross_street.
-
#destinations ⇒ Object
Returns the value of attribute destinations.
-
#entering ⇒ Object
Returns the value of attribute entering.
-
#exiting ⇒ Object
Returns the value of attribute exiting.
-
#fill_time ⇒ Object
Returns the value of attribute fill_time.
-
#food ⇒ Object
Returns the value of attribute food.
-
#geo ⇒ Object
Returns the value of attribute geo.
-
#intro ⇒ Object
Returns the value of attribute intro.
-
#link ⇒ Object
Returns the value of attribute link.
-
#locker_flag ⇒ Object
Returns the value of attribute locker_flag.
-
#lockers ⇒ Object
Returns the value of attribute lockers.
-
#north_platforms ⇒ Object
Returns the value of attribute north_platforms.
-
#north_routes ⇒ Object
Returns the value of attribute north_routes.
-
#parking ⇒ Object
Returns the value of attribute parking.
-
#parking_flag ⇒ Object
Returns the value of attribute parking_flag.
-
#platform_info ⇒ Object
Returns the value of attribute platform_info.
-
#shopping ⇒ Object
Returns the value of attribute shopping.
-
#south_platforms ⇒ Object
Returns the value of attribute south_platforms.
-
#south_routes ⇒ Object
Returns the value of attribute south_routes.
-
#state ⇒ Object
Returns the value of attribute state.
-
#transit_info ⇒ Object
Returns the value of attribute transit_info.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
Instance Attribute Details
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def abbreviation @abbreviation end |
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def address @address end |
#attraction ⇒ Object
Returns the value of attribute attraction.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def attraction @attraction end |
#bike_flag ⇒ Object
Returns the value of attribute bike_flag.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def bike_flag @bike_flag end |
#bike_station_flag ⇒ Object
Returns the value of attribute bike_station_flag.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def bike_station_flag @bike_station_flag end |
#bike_station_text ⇒ Object
Returns the value of attribute bike_station_text.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def bike_station_text @bike_station_text end |
#car_share ⇒ Object
Returns the value of attribute car_share.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def car_share @car_share end |
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def city @city end |
#county ⇒ Object
Returns the value of attribute county.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def county @county end |
#cross_street ⇒ Object
Returns the value of attribute cross_street.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def cross_street @cross_street end |
#destinations ⇒ Object
Returns the value of attribute destinations.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def destinations @destinations end |
#entering ⇒ Object
Returns the value of attribute entering.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def entering @entering end |
#exiting ⇒ Object
Returns the value of attribute exiting.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def exiting @exiting end |
#fill_time ⇒ Object
Returns the value of attribute fill_time.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def fill_time @fill_time end |
#food ⇒ Object
Returns the value of attribute food.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def food @food end |
#geo ⇒ Object
Returns the value of attribute geo.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def geo @geo end |
#intro ⇒ Object
Returns the value of attribute intro.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def intro @intro end |
#link ⇒ Object
Returns the value of attribute link.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def link @link end |
#locker_flag ⇒ Object
Returns the value of attribute locker_flag.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def locker_flag @locker_flag end |
#lockers ⇒ Object
Returns the value of attribute lockers.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def lockers @lockers end |
#north_platforms ⇒ Object
Returns the value of attribute north_platforms.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def north_platforms @north_platforms end |
#north_routes ⇒ Object
Returns the value of attribute north_routes.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def north_routes @north_routes end |
#parking ⇒ Object
Returns the value of attribute parking.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def parking @parking end |
#parking_flag ⇒ Object
Returns the value of attribute parking_flag.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def parking_flag @parking_flag end |
#platform_info ⇒ Object
Returns the value of attribute platform_info.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def platform_info @platform_info end |
#shopping ⇒ Object
Returns the value of attribute shopping.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def shopping @shopping end |
#south_platforms ⇒ Object
Returns the value of attribute south_platforms.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def south_platforms @south_platforms end |
#south_routes ⇒ Object
Returns the value of attribute south_routes.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def south_routes @south_routes end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def state @state end |
#transit_info ⇒ Object
Returns the value of attribute transit_info.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def transit_info @transit_info end |
#zip ⇒ Object
Returns the value of attribute zip.
4 5 6 |
# File 'lib/bort/station.rb', line 4 def zip @zip end |
Class Method Details
.parse(doc) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bort/station.rb', line 11 def self.parse(doc) station = Station.new station.abbreviation = (doc/:abbr).inner_text station.destinations = (doc/:destinations).inner_text station.north_routes = (doc/:north_routes/:route).map(&:inner_text) station.south_routes = (doc/:south_routes/:route).map(&:inner_text) station.north_platforms = (doc/:north_platforms/:platform).map(&:inner_text).map(&:to_i) station.south_platforms = (doc/:south_platforms/:platform).map(&:inner_text).map(&:to_i) station.platform_info = (doc/:platform_info).inner_text latitude = (doc/:gtfs_latitude).inner_text longitude = (doc/:gtfs_longitude).inner_text station.geo = [latitude, longitude] if latitude and longitude station.address = (doc/:address).inner_text station.city = (doc/:city).inner_text station.county = (doc/:county).inner_text station.state = (doc/:state).inner_text station.zip = (doc/:zipcode).inner_text station.cross_street = (doc/:cross_street).inner_text station.bike_flag = parse_flag(doc.attributes['bike_flag']) station.bike_station_flag = parse_flag(doc.attributes['bike_station_flag']) station.bike_station_text = (doc/:bike_station_text).inner_text station.parking = (doc/:parking).inner_text station.parking_flag = parse_flag(doc.attributes['parking_flag']) station.transit_info = (doc/:transit_info).inner_text station.car_share = (doc/:car_share).inner_text station.entering = (doc/:entering).inner_text station.exiting = (doc/:exiting).inner_text station.attraction = (doc/:attraction).inner_text station.shopping = (doc/:shopping).inner_text station.food = (doc/:food).inner_text station.intro = (doc/:intro).inner_text station.locker_flag = parse_flag(doc.attributes['locker_flag']) station.lockers = (doc/:lockers).inner_text station.fill_time = (doc/:fill_time).inner_text station.link = (doc/:link).inner_text station end |
.parse_flag(flag) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/bort/station.rb', line 54 def self.parse_flag(flag) case flag when '1' then true when '0' then false else nil end end |