Class: SearchKit::Events::Poll::Process
- Inherits:
-
Object
- Object
- SearchKit::Events::Poll::Process
- Defined in:
- lib/search_kit/events/poll/process.rb
Overview
The logic of interacting with the event service to retrieve and process events is contained here.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(channel, &block) ⇒ Process
constructor
A new instance of Process.
- #perform ⇒ Object
Constructor Details
#initialize(channel, &block) ⇒ Process
Returns a new instance of Process.
14 15 16 17 18 |
# File 'lib/search_kit/events/poll/process.rb', line 14 def initialize(channel, &block) @block = block @channel = channel @client = SearchKit::Events.new end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
12 13 14 |
# File 'lib/search_kit/events/poll/process.rb', line 12 def block @block end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
12 13 14 |
# File 'lib/search_kit/events/poll/process.rb', line 12 def channel @channel end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
12 13 14 |
# File 'lib/search_kit/events/poll/process.rb', line 12 def client @client end |
Class Method Details
.perform(channel, &block) ⇒ Object
8 9 10 |
# File 'lib/search_kit/events/poll/process.rb', line 8 def self.perform(channel, &block) new(channel, &block).perform end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/search_kit/events/poll/process.rb', line 20 def perform events.each do |event| begin block.call(event) rescue raise else client.complete(event.id) end end end |