class Gtt5tApiClient::TimeTable::DOMTable
Public Class Methods
new(dom_table)
click to toggle source
# File lib/gtt_5t_api_client/time_table/dom_table.rb, line 6 def initialize(dom_table) @dom_table = dom_table end
Public Instance Methods
times()
click to toggle source
# File lib/gtt_5t_api_client/time_table/dom_table.rb, line 10 def times @times ||= dom_rows.inject({}) do |hash, dom_row| hash.merge!(:"#{dom_row.bus_number}" => dom_row.arrival_times) end end
Private Instance Methods
dom_rows()
click to toggle source
# File lib/gtt_5t_api_client/time_table/dom_table.rb, line 18 def dom_rows @dom_rows ||= @dom_table .css('tr') .select { |element| element.is_a?(Nokogiri::XML::Element) } .map { |element| DOMRow.new(element) } end