Class: Bort::Schedule::Leg
- Inherits:
-
Object
- Object
- Bort::Schedule::Leg
- Defined in:
- lib/bort/schedule.rb
Instance Attribute Summary collapse
-
#bike_flag ⇒ Object
Returns the value of attribute bike_flag.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#destination_date ⇒ Object
Returns the value of attribute destination_date.
-
#destination_time ⇒ Object
Returns the value of attribute destination_time.
-
#line ⇒ Object
Returns the value of attribute line.
-
#order ⇒ Object
Returns the value of attribute order.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#origin_date ⇒ Object
Returns the value of attribute origin_date.
-
#origin_time ⇒ Object
Returns the value of attribute origin_time.
-
#train_head_station ⇒ Object
Returns the value of attribute train_head_station.
-
#transfer_code ⇒ Object
Returns the value of attribute transfer_code.
Class Method Summary collapse
Instance Attribute Details
#bike_flag ⇒ Object
Returns the value of attribute bike_flag.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def bike_flag @bike_flag end |
#destination ⇒ Object
Returns the value of attribute destination.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def destination @destination end |
#destination_date ⇒ Object
Returns the value of attribute destination_date.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def destination_date @destination_date end |
#destination_time ⇒ Object
Returns the value of attribute destination_time.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def destination_time @destination_time end |
#line ⇒ Object
Returns the value of attribute line.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def line @line end |
#order ⇒ Object
Returns the value of attribute order.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def order @order end |
#origin ⇒ Object
Returns the value of attribute origin.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def origin @origin end |
#origin_date ⇒ Object
Returns the value of attribute origin_date.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def origin_date @origin_date end |
#origin_time ⇒ Object
Returns the value of attribute origin_time.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def origin_time @origin_time end |
#train_head_station ⇒ Object
Returns the value of attribute train_head_station.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def train_head_station @train_head_station end |
#transfer_code ⇒ Object
Returns the value of attribute transfer_code.
81 82 83 |
# File 'lib/bort/schedule.rb', line 81 def transfer_code @transfer_code end |
Class Method Details
.parse(doc) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/bort/schedule.rb', line 85 def self.parse(doc) leg = Leg.new leg.order = doc.attributes['order'].to_i leg.transfer_code = doc.attributes['transfercode'] leg.origin = doc.attributes['origin'] leg.destination = doc.attributes['destination'] leg.origin_date = Date.parse(doc.attributes['origtimedate']) leg.destination_date = Date.parse(doc.attributes['desttimedate']) leg.origin_time = Time.parse("#{doc.attributes['origtimedate']} #{doc.attributes['origtimemin']}") leg.destination_time = Time.parse("#{doc.attributes['desttimedate']} #{doc.attributes['desttimemin']}") leg.line = doc.attributes['line'] leg.bike_flag = doc.attributes['bikeflag'] == '1' leg.train_head_station = doc.attributes['trainheadstation'] leg end |