class Muni::Stop

Public Instance Methods

predictions() click to toggle source
# File lib/muni/stop.rb, line 6
def predictions
  stop = Stop.send(:fetch, :predictions, r: route_tag, d: direction, s: tag)
  available_predictions(stop).collect do |pred|
    Prediction.new(pred)
  end
end

Private Instance Methods

available_predictions(stop) click to toggle source
# File lib/muni/stop.rb, line 15
def available_predictions(stop)
  return [] unless  stop && 
                    stop['predictions'] && 
                    stop['predictions'].first['direction'] &&
                    stop['predictions'].first['direction'].first['prediction']
                    
  stop['predictions'].first['direction'].first['prediction']
end