Module: Consumer::Controls::Handle
- Defined in:
- lib/consumer/controls/handle.rb,
lib/consumer/controls/handle/settings.rb,
lib/consumer/controls/handle/raise_error.rb
Defined Under Namespace
Modules: RaiseError, Settings
Constant Summary
collapse
- Example =
self.example_class
Class Method Summary
collapse
Class Method Details
.example ⇒ Object
4
5
6
|
# File 'lib/consumer/controls/handle.rb', line 4
def self.example
example_class.new
end
|
.example_class ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/consumer/controls/handle.rb', line 8
def self.example_class
Class.new do
include Messaging::Handle
include Handle
attr_accessor :session
def configure(session: nil)
self.session = session
end
def self.handled_messages
@@handled_messages ||= []
end
def handle(message_data)
handled_messages << message_data
end
def handled_messages
self.class.handled_messages
end
def handled?(message_data=nil)
if message_data.nil?
handled_messages.any?
else
handled_messages.include?(message_data)
end
end
def session?(session=nil)
if session.nil?
!self.session.nil?
else
session == self.session
end
end
end
end
|