Class: RedisIPC::Channel::Event
- Inherits:
-
Object
- Object
- RedisIPC::Channel::Event
- Defined in:
- lib/redis_ipc/channel.rb
Overview
Holds event params and the callback This also gives a container for calling said callback
Instance Attribute Summary collapse
-
#group_name ⇒ Object
readonly
Returns the value of attribute group_name.
-
#instance_id ⇒ Object
readonly
Returns the value of attribute instance_id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#source_group ⇒ Object
readonly
Returns the value of attribute source_group.
-
#stream_name ⇒ Object
readonly
Returns the value of attribute stream_name.
Instance Method Summary collapse
- #execute(params:, stream_name:, group_name:, instance_id:, entry: nil) ⇒ Object
-
#initialize(params, &callback) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(params, &callback) ⇒ Event
Returns a new instance of Event.
169 170 171 172 173 174 |
# File 'lib/redis_ipc/channel.rb', line 169 def initialize(params, &callback) @params_layout = params @params = nil define_singleton_method(:execute_callback, &callback) end |
Instance Attribute Details
#group_name ⇒ Object (readonly)
Returns the value of attribute group_name.
167 168 169 |
# File 'lib/redis_ipc/channel.rb', line 167 def group_name @group_name end |
#instance_id ⇒ Object (readonly)
Returns the value of attribute instance_id.
167 168 169 |
# File 'lib/redis_ipc/channel.rb', line 167 def instance_id @instance_id end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
167 168 169 |
# File 'lib/redis_ipc/channel.rb', line 167 def params @params end |
#source_group ⇒ Object (readonly)
Returns the value of attribute source_group.
167 168 169 |
# File 'lib/redis_ipc/channel.rb', line 167 def source_group @source_group end |
#stream_name ⇒ Object (readonly)
Returns the value of attribute stream_name.
167 168 169 |
# File 'lib/redis_ipc/channel.rb', line 167 def stream_name @stream_name end |
Instance Method Details
#execute(params:, stream_name:, group_name:, instance_id:, entry: nil) ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/redis_ipc/channel.rb', line 176 def execute(params:, stream_name:, group_name:, instance_id:, entry: nil) @params = params.with_indifferent_access.slice(*@params_layout) @stream_name = stream_name @group_name = group_name @source_group = entry&.source_group @instance_id = instance_id execute_callback ensure @params = nil end |