class Consummo::FeedProcessor

Public Class Methods

new(feeds = [], enrichers: []) click to toggle source
# File lib/consummo/feed_processor.rb, line 3
def initialize(feeds = [], enrichers: [])
  @feeds = feeds
  @enrichers = enrichers
end

Public Instance Methods

process() click to toggle source
# File lib/consummo/feed_processor.rb, line 8
def process
  producer = ItemProducer.new(feeds: @feeds)
  consumer = ItemConsumer.new(items: producer.produce, enrichers: @enrichers)
  persist(consumer.consume)
end

Private Instance Methods

persist(items) click to toggle source
# File lib/consummo/feed_processor.rb, line 15
def persist(items)
  items.each do |item|
    FeedItem.create(item.attributes)
  end
end