Class: Bort::Route::Route

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#abbreviationObject

Returns the value of attribute abbreviation.



4
5
6
# File 'lib/bort/route.rb', line 4

def abbreviation
  @abbreviation
end

#colorObject

Returns the value of attribute color.



4
5
6
# File 'lib/bort/route.rb', line 4

def color
  @color
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/bort/route.rb', line 4

def name
  @name
end

#numberObject

Returns the value of attribute number.



4
5
6
# File 'lib/bort/route.rb', line 4

def number
  @number
end

#route_idObject

Returns the value of attribute route_id.



4
5
6
# File 'lib/bort/route.rb', line 4

def route_id
  @route_id
end

Class Method Details

.parse(doc) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/bort/route.rb', line 5

def self.parse(doc)
  route = Route.new
  route.name         = (doc/:name).inner_text
  route.abbreviation = (doc/:abbr).inner_text
  route.route_id     = (doc/:routeid).inner_text
  route.number       = (doc/:number).inner_text.to_i
  route.color        = (doc/:color).inner_text

  route
end

Instance Method Details

#<=>(other) ⇒ Object



24
25
26
# File 'lib/bort/route.rb', line 24

def <=> other
  self.number <=> other.number
end

#info(options = {}) ⇒ Object



16
17
18
# File 'lib/bort/route.rb', line 16

def info(options={})
  Info.new(number, options)
end

#schedule(options = {}) ⇒ Object



20
21
22
# File 'lib/bort/route.rb', line 20

def schedule(options={})
  Schedule::RouteSchedule.new(number, options)
end