Module: Bort::Schedule
- Defined in:
- lib/bort/schedule.rb
Defined Under Namespace
Classes: Fare, HolidayData, Leg, RouteSchedule, Schedule, SpecialSchedule, StationLine, StationSchedule, Stop, TrainSchedule, Trip, Trips
Class Method Summary
collapse
Class Method Details
.fare(orig, dest, options = {}) ⇒ Object
103
104
105
|
# File 'lib/bort/schedule.rb', line 103
def self.fare(orig, dest, options={})
Fare.new(orig, dest, options).fare
end
|
.holidays ⇒ Object
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/bort/schedule.rb', line 140
def self.holidays
download_options = {
:action => 'sched',
:cmd => 'holiday',
}
xml = Util.download(download_options)
data = Hpricot(xml)
(data/:holiday).map{|holiday|HolidayData.parse(holiday)}
end
|
.schedules ⇒ Object
226
227
228
229
230
231
232
233
234
235
236
|
# File 'lib/bort/schedule.rb', line 226
def self.schedules
download_options = {
:action => 'sched',
:cmd => 'scheds',
}
xml = Util.download(download_options)
data = Hpricot(xml)
(data/:schedule).map{|schedule| Schedule.parse(schedule)}.sort
end
|
.special_schedules(print_legend = false) ⇒ Object
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
# File 'lib/bort/schedule.rb', line 254
def self.special_schedules(print_legend=false)
download_options = {
:action => 'sched',
:cmd => 'special',
:l => print_legend ? '1' : '0',
}
xml = Util.download(download_options)
data = Hpricot(xml)
puts (data/:legend).inner_text if print_legend
(data/:special_schedule).map{|special| SpecialSchedule.parse(special)}
end
|
.trips_by_arrival(orig, dest, options = {}) ⇒ Object
3
4
5
|
# File 'lib/bort/schedule.rb', line 3
def self.trips_by_arrival(orig, dest, options={})
Trips.new('arrive', orig, dest, options).trips
end
|
.trips_by_departure(orig, dest, options = {}) ⇒ Object
7
8
9
|
# File 'lib/bort/schedule.rb', line 7
def self.trips_by_departure(orig, dest, options={})
Trips.new('depart', orig, dest, options).trips
end
|