Class: Bort::Schedule::StationSchedule
- Inherits:
-
Object
- Object
- Bort::Schedule::StationSchedule
- Defined in:
- lib/bort/schedule.rb
Instance Attribute Summary collapse
-
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
-
#date ⇒ Object
Returns the value of attribute date.
-
#legend ⇒ Object
Returns the value of attribute legend.
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
-
#schedules ⇒ Object
Returns the value of attribute schedules.
Instance Method Summary collapse
-
#initialize(origin, options = {}) ⇒ StationSchedule
constructor
A new instance of StationSchedule.
Constructor Details
#initialize(origin, options = {}) ⇒ StationSchedule
Returns a new instance of StationSchedule.
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/bort/schedule.rb', line 293 def initialize(origin, ={}) () = { :action => 'sched', :cmd => 'stnsched', :orig => origin, :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.name = (data/:name).inner_text self.abbreviation = (data/:abbr).inner_text self.legend = (data/:legend).inner_text self.schedules = (data/:station/:item).map{|line| StationLine.parse(line, date)} end |
Instance Attribute Details
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def abbreviation @abbreviation end |
#date ⇒ Object
Returns the value of attribute date.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def date @date end |
#legend ⇒ Object
Returns the value of attribute legend.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def legend @legend end |
#name ⇒ Object
Returns the value of attribute name.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def origin @origin end |
#schedule_number ⇒ Object
Returns the value of attribute schedule_number.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def schedule_number @schedule_number end |
#schedules ⇒ Object
Returns the value of attribute schedules.
291 292 293 |
# File 'lib/bort/schedule.rb', line 291 def schedules @schedules end |