Sha256: afc87fda4b5049eb402c70d7e74958181f3a166a7a554f40549802db59bc10a3

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

class Stop
  attr_accessor :arrival_times, :id, :link, :name

  def initialize(name, link)
    @name, @link = name, link
    @id = @link.split("/")[-1]
  end

  # Returns array of arrival times (Strings) for the Stop
  # Note: untested as PennRide isn't operating over winter break
  def arrival_times(link = @link)
    @arrival_times = Wombat.crawl {
      base_url ROOT
      path link
      times "xpath=//ul/li[not(contains(@class,'arrow'))]/text()", :list
    }['times'] unless @arrival_times
    @arrival_times
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pennride-0.1.1 lib/pennride/stop.rb
pennride-0.1 lib/pennride/stop.rb