Sha256: 080b3998fdb24beb416ea5f4a622629055be3783168020b7e6963e5fe58790b0
Contents?: true
Size: 916 Bytes
Versions: 1
Compression:
Stored size: 916 Bytes
Contents
module SearchKit class Events class Poll # The logic of interacting with the event service to retrieve and process # events is contained here. # class Process def self.perform(channel, &block) new(channel, &block).perform end attr_reader :block, :channel, :client def initialize(channel, &block) @block = block @channel = channel @client = SearchKit::Events.new end def perform events.each do |event| begin block.call(event) rescue raise else client.complete(event.id) end end end private def events response = client.pending(channel) response.fetch(:data, []).map { |raw| OpenStruct.new(raw) } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search-kit-0.0.2 | lib/search_kit/events/poll/process.rb |