Sha256: bb2bce9d801064012019fd299f808f38ba828d3b0908904dba86a9b413268cf7

Contents?: true

Size: 382 Bytes

Versions: 1

Compression:

Stored size: 382 Bytes

Contents

module Feed2Gram
  class UpdatesCache
    def update!(cache, results, cache_path)
      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

      File.write(cache_path, cache.as_yaml)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feed2gram-0.0.2 lib/feed2gram/updates_cache.rb