Sha256: fa2277982cd34ee1f6ef48150fe31734fc69a6624bd33e7342dddeb05bcaba44

Contents?: true

Size: 467 Bytes

Versions: 10

Compression:

Stored size: 467 Bytes

Contents

module Feed2Gram
  class UpdatesCache
    def update!(cache, results, options)
      cache.updated_at = Time.now
      results.group_by { |result| result.status }
        .transform_values { |results| results.map { |result| result.post.url } }
        .each do |status, urls|
        cache[status] += urls
      end

      puts "Writing updated cache to: #{options.cache_path}" if options.verbose
      File.write(options.cache_path, cache.as_yaml)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
feed2gram-1.4.0 lib/feed2gram/updates_cache.rb
feed2gram-1.3.0 lib/feed2gram/updates_cache.rb
feed2gram-1.2.4 lib/feed2gram/updates_cache.rb
feed2gram-1.2.2 lib/feed2gram/updates_cache.rb
feed2gram-1.2.1 lib/feed2gram/updates_cache.rb
feed2gram-1.2.0 lib/feed2gram/updates_cache.rb
feed2gram-1.1.0 lib/feed2gram/updates_cache.rb
feed2gram-1.0.0 lib/feed2gram/updates_cache.rb
feed2gram-0.0.4 lib/feed2gram/updates_cache.rb
feed2gram-0.0.3 lib/feed2gram/updates_cache.rb