Class: Bort::Schedule::Trips
- Inherits:
-
Object
- Object
- Bort::Schedule::Trips
- Defined in:
- lib/bort/schedule.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#date ⇒ Object
Returns the value of attribute date.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#legend ⇒ Object
Returns the value of attribute legend.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
-
#time ⇒ Object
Returns the value of attribute time.
-
#trips ⇒ Object
Returns the value of attribute trips.
Instance Method Summary collapse
-
#initialize(command, orig, dest, options = {}) ⇒ Trips
constructor
A new instance of Trips.
Constructor Details
#initialize(command, orig, dest, options = {}) ⇒ Trips
Returns a new instance of Trips.
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 |
# File 'lib/bort/schedule.rb', line 15 def initialize(command, orig, dest, ={}) self.origin = orig self.destination = dest () = { :action => 'sched', :cmd => command, :orig => origin, :dest => destination, :time => time, :date => date, :b => before, :a => after, :l => legend, } xml = Util.download() data = Hpricot(xml) self.date = Date.parse((data/:date).inner_text) self.time = Time.parse("#{(data/:date).inner_text} #{(data/:time).inner_text}") self.before = (data/:before).inner_text.to_i self.after = (data/:after).inner_text.to_i self.legend = (data/:legend).inner_text self.schedule_number = (data/:sched_num).inner_text self.trips = (data/:trip).map{|trip| Trip.parse(trip)} end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def before @before end |
#date ⇒ Object
Returns the value of attribute date.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def date @date end |
#destination ⇒ Object
Returns the value of attribute destination.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def destination @destination end |
#legend ⇒ Object
Returns the value of attribute legend.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def legend @legend end |
#origin ⇒ Object
Returns the value of attribute origin.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def origin @origin end |
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def schedule_number @schedule_number end |
#time ⇒ Object
Returns the value of attribute time.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def time @time end |
#trips ⇒ Object
Returns the value of attribute trips.
12 13 14 |
# File 'lib/bort/schedule.rb', line 12 def trips @trips end |