Class: Jets::Shim::Adapter::Event
- Inherits:
-
Base
- Object
- Base
- Jets::Shim::Adapter::Event
show all
- Defined in:
- lib/jets/shim/adapter/event.rb
Instance Attribute Summary
Attributes inherited from Base
#context, #event, #target
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#log
Instance Method Details
#handle ⇒ Object
3
4
5
|
# File 'lib/jets/shim/adapter/event.rb', line 3
def handle
target_class.handle(event, context, target_method)
end
|
#handle? ⇒ Boolean
7
8
9
|
# File 'lib/jets/shim/adapter/event.rb', line 7
def handle?
target && target_class && target_method?
end
|
#target_class ⇒ Object
11
12
13
14
15
|
# File 'lib/jets/shim/adapter/event.rb', line 11
def target_class
class_name, _ = target.split(".")
class_name.camelize.constantize
rescue NameError
end
|
#target_method ⇒ Object
17
18
19
20
21
|
# File 'lib/jets/shim/adapter/event.rb', line 17
def target_method
_, method_name = target.split(".")
method_name ||= "perform"
method_name.to_sym
end
|
#target_method? ⇒ Boolean
23
24
25
|
# File 'lib/jets/shim/adapter/event.rb', line 23
def target_method?
target_class.public_instance_methods.include?(target_method)
end
|