require 'wombat' Dir[File.dirname(__FILE__) + "/pennride/*.rb"].each { |file| require file } ROOT = 'http://pennrides.com' class PennRide attr_accessor :routes # Returns array of instantiated Routes def initialize(root = ROOT) @root = root @routes = Wombat.crawl { base_url ROOT path '/simple/routes' routes "xpath=//li[@class='arrow']", :iterator do name "xpath=./a/text()" href "xpath=./a/@href" end }['routes'].map { |r| Route.new(r['name'], r['href']) } end end