Module: KrkTimetables

Defined in:
lib/krk-timetables.rb,
lib/krk-timetables/version.rb

Defined Under Namespace

Classes: Departure, Line, Stop

Constant Summary collapse

URL_PREFIX =
"http://rozklady.mpk.krakow.pl/aktualne/"
STOPS_PATH =
"przystan.htm"
VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.stopsObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/krk-timetables.rb', line 14

def KrkTimetables.stops
  doc = Nokogiri::HTML(open(URL_PREFIX + STOPS_PATH))
  stops = []

  doc.css('table li a').each do |stop_link|
    stops << Stop.new(stop_link.content, stop_link.attributes["href"].value)
  end

  stops
end