module TideScraper
Constants
- VERSION
Public Class Methods
get_next_tide(prediction)
click to toggle source
Return the next prediction for a sorted list of tides (produced by get_prediction - sorted by default)
# File lib/tide_scraper.rb, line 10 def self.get_next_tide(prediction) prediction.each do |tide| if tide[:time] > Time.now return tide end end # Should have found a tide by now. If not, empty set return [] end
get_upcoming_tides(prediction)
click to toggle source
Given a sorted list of tides, only return tides that are in the future
# File lib/tide_scraper.rb, line 22 def self.get_upcoming_tides(prediction) future_tides = [] prediction.each do |tide| if tide[:time] > Time.now future_tides.push tide end end return future_tides end