Class: Bort::Schedule::RouteSchedule
- Inherits:
-
Object
- Object
- Bort::Schedule::RouteSchedule
- Defined in:
- lib/bort/schedule.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#legend ⇒ Object
Returns the value of attribute legend.
-
#route_number ⇒ Object
Returns the value of attribute route_number.
-
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
-
#trains ⇒ Object
Returns the value of attribute trains.
Instance Method Summary collapse
-
#initialize(route_num, options = {}) ⇒ RouteSchedule
constructor
A new instance of RouteSchedule.
Constructor Details
#initialize(route_num, options = {}) ⇒ RouteSchedule
Returns a new instance of RouteSchedule.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/bort/schedule.rb', line 168 def initialize(route_num, ={}) self.route_number = route_num () = { :action => 'sched', :cmd => 'routesched', :route => route_number, :sched => schedule_number, :date => date, :l => legend, } xml = Util.download() data = Hpricot(xml) self.date = Date.parse((data/:date).inner_text) self.schedule_number = (data/:sched_num).inner_text.to_i self.trains = (data/:train).map{|train| TrainSchedule.parse(train, date)} self.legend = (data/:legend).inner_text end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
166 167 168 |
# File 'lib/bort/schedule.rb', line 166 def date @date end |
#legend ⇒ Object
Returns the value of attribute legend.
166 167 168 |
# File 'lib/bort/schedule.rb', line 166 def legend @legend end |
#route_number ⇒ Object
Returns the value of attribute route_number.
166 167 168 |
# File 'lib/bort/schedule.rb', line 166 def route_number @route_number end |
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
166 167 168 |
# File 'lib/bort/schedule.rb', line 166 def schedule_number @schedule_number end |
#trains ⇒ Object
Returns the value of attribute trains.
166 167 168 |
# File 'lib/bort/schedule.rb', line 166 def trains @trains end |