Sha256: 6ff31cb35014d496f7d70605d2b692db7a17deebc11ed5ae2a1ba193b1c819e4

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

# Helps getting provider classes which should be executed because
# there might be updated weather
module WeatherFetcher
  class SchedulerHelper

    def self.recommended_providers(_wd, speed = 0.7)
      # all available
      all_providers_classes = ProviderList.providers(speed)

      # getting list providers to remove because there is now
      # new weather available
      providers_to_remove = _wd.select{|w| w.next_fetch_time > Time.now}.collect{|w| w.provider}.uniq

      # remove providers
      recommended = all_providers_classes.select{|k| puts k.provider_name.inspect; ([k.provider_name] & providers_to_remove).size == 0}

      return recommended
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
weather_fetcher-0.1.5 lib/weather_fetcher/scheduler_helper.rb
weather_fetcher-0.1.4 lib/weather_fetcher/scheduler_helper.rb
weather_fetcher-0.1.3 lib/weather_fetcher/scheduler_helper.rb
weather_fetcher-0.1.2 lib/weather_fetcher/scheduler_helper.rb
weather_fetcher-0.1.1 lib/weather_fetcher/scheduler_helper.rb