Class: Bort::Route::Routes

Inherits:
Object
  • Object
show all
Defined in:
lib/bort/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Routes

Returns a new instance of Routes.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bort/route.rb', line 36

def initialize(options={})
  load_options(options)

  download_options = {
    :action => 'route',
    :cmd => 'routes',
  }
  download_options[:sched]  = schedule
  download_options[:date]   = date

  xml = Util.download(download_options)
  data = Hpricot(xml)

  self.schedule_number = (data/:sched_num).inner_text
  self.routes = (data/:route).map do |route|
    Route.parse(route)
  end.sort
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



34
35
36
# File 'lib/bort/route.rb', line 34

def date
  @date
end

#routesObject

Returns the value of attribute routes.



34
35
36
# File 'lib/bort/route.rb', line 34

def routes
  @routes
end

#scheduleObject

Returns the value of attribute schedule.



34
35
36
# File 'lib/bort/route.rb', line 34

def schedule
  @schedule
end

#schedule_numberObject

Returns the value of attribute schedule_number.



34
35
36
# File 'lib/bort/route.rb', line 34

def schedule_number
  @schedule_number
end