Class: SJCBusSchedule::Parser::Bus
- Inherits:
-
Object
- Object
- SJCBusSchedule::Parser::Bus
- Defined in:
- lib/sjc_bus_schedule/parser/parser.rb
Instance Method Summary collapse
- #direction ⇒ Object
-
#initialize(doc:) ⇒ Bus
constructor
A new instance of Bus.
- #itinerary ⇒ Object
- #name ⇒ Object
- #note ⇒ Object
- #number ⇒ Object
Constructor Details
#initialize(doc:) ⇒ Bus
Returns a new instance of Bus.
7 8 9 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 7 def initialize(doc:) @doc = doc end |
Instance Method Details
#direction ⇒ Object
19 20 21 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 19 def direction @direction ||= @doc.css("span[id*=Sentido]").first.text.strip end |
#itinerary ⇒ Object
23 24 25 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 23 def itinerary @itinerary ||= @doc.css("span[id*=Itinerario]").first.text.split(/[-–]/).map(&:strip) end |
#name ⇒ Object
15 16 17 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 15 def name @name ||= @doc.css("span[id*=NomeLinha]").first.text.strip end |
#note ⇒ Object
27 28 29 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 27 def note @note ||= @doc.css("span[id*=Observacao]").first.text.strip end |
#number ⇒ Object
11 12 13 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 11 def number @number ||= @doc.css("span[id*=NumeroLinha]").first.text.strip end |