Module: TideScraper

Defined in:
lib/tide_scraper.rb,
lib/tide_scraper/ports.rb,
lib/tide_scraper/scraper.rb,
lib/tide_scraper/version.rb,
lib/tide_scraper/predictions.rb

Defined Under Namespace

Classes: Scraper

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.get_next_tide(prediction) ⇒ Object

Return the next prediction for a sorted list of tides (produced by get_prediction - sorted by default)



11
12
13
14
15
16
17
18
19
# File 'lib/tide_scraper.rb', line 11

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