Class: Feed2Gram::UpdatesCache
- Inherits:
-
Object
- Object
- Feed2Gram::UpdatesCache
- Defined in:
- lib/feed2gram/updates_cache.rb
Instance Method Summary collapse
Instance Method Details
#update!(cache, results, options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/feed2gram/updates_cache.rb', line 3 def update!(cache, results, ) 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: #{.cache_path}" if .verbose File.write(.cache_path, cache.as_yaml) end |