class Muni::Direction

Public Instance Methods

stop_at(place) click to toggle source
# File lib/muni/direction.rb, line 5
def stop_at(place)
  if stop = stops.detect { |stop| stop.tag == place }
    return stop
  end

  if stop = stops.detect { |stop| stop.title == place }
    return stop
  end

  pattern = Amatch::Sellers.new(place)
  stops.sort_by{ |stop|
    pattern.match(stop.title)
  }.first
end