Class: SJCBusSchedule::Parser::Schedules
- Inherits:
-
Object
- Object
- SJCBusSchedule::Parser::Schedules
- Defined in:
- lib/sjc_bus_schedule/parser/parser.rb
Instance Method Summary collapse
-
#initialize(doc:) ⇒ Schedules
constructor
A new instance of Schedules.
- #references ⇒ Object
- #schedules ⇒ Object
Constructor Details
#initialize(doc:) ⇒ Schedules
Returns a new instance of Schedules.
33 34 35 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 33 def initialize(doc:) @doc = doc end |
Instance Method Details
#references ⇒ Object
43 44 45 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 43 def references @references ||= @doc.css("span[id*=Resultado] .textosm").children.map(&:text).reject { |it| it.empty? } end |
#schedules ⇒ Object
37 38 39 40 41 |
# File 'lib/sjc_bus_schedule/parser/parser.rb', line 37 def schedules @schedules ||= @doc.css("span[id*=Resultado] > table").map do |schedule| { period: period(schedule), hours: hours(schedule) } end end |