Module: PhobosDBCheckpoint::EventHelper
- Included in:
- Event, Failure
- Defined in:
- lib/phobos_db_checkpoint/event_helper.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/phobos_db_checkpoint/event_helper.rb', line 22
def method_missing(method_name, *args, &block)
if method_name.to_s =~ /^fetch_(.*)/
method = Regexp.last_match(1)
handler = configured_handler.new
handler.send(method, payload) if handler.respond_to?(method)
else
super
end
end
|
Instance Method Details
16
17
18
19
20
|
# File 'lib/phobos_db_checkpoint/event_helper.rb', line 16
def configured_handler
configured_listener
.handler
.constantize
end
|
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/phobos_db_checkpoint/event_helper.rb', line 5
def configured_listener
listener = Phobos
.config
.listeners
.find { |l| l.group_id == group_id }
raise(ListenerNotFoundError, group_id) unless listener
listener
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
32
33
34
|
# File 'lib/phobos_db_checkpoint/event_helper.rb', line 32
def respond_to_missing?(method_name, include_private = false)
method_name.to_s.start_with?('fetch_') || super
end
|