Module: ActionService::Invocation::InstanceMethods
- Defined in:
- lib/action_service/invocation.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
- #after_invocation(name, args, result) ⇒ Object
- #before_invocation(name, args, &block) ⇒ Object
- #perform_invocation(name, args = nil) ⇒ Object
- #perform_invocation_with_interception(name, args = nil, &block) ⇒ Object
Class Method Details
.append_features(base) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/action_service/invocation.rb', line 90 def self.append_features(base) super base.class_eval do alias_method :perform_invocation_without_interception, :perform_invocation alias_method :perform_invocation, :perform_invocation_with_interception end end |
Instance Method Details
#after_invocation(name, args, result) ⇒ Object
117 118 119 |
# File 'lib/action_service/invocation.rb', line 117 def after_invocation(name, args, result) call_interceptors(self.class.after_invocation_interceptors, [name, args, result]) end |
#before_invocation(name, args, &block) ⇒ Object
113 114 115 |
# File 'lib/action_service/invocation.rb', line 113 def before_invocation(name, args, &block) call_interceptors(self.class.before_invocation_interceptors, [name, args], &block) end |
#perform_invocation(name, args = nil) ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/action_service/invocation.rb', line 105 def perform_invocation(name, args=nil) unless self.respond_to?(name) and self.class.has_export?(name) raise InvocationError, "no such exported method '#{name}'" end args ||= [] self.send(name, *args) end |
#perform_invocation_with_interception(name, args = nil, &block) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/action_service/invocation.rb', line 98 def perform_invocation_with_interception(name, args=nil, &block) return if before_invocation(name, args, &block) == false result = perform_invocation_without_interception(name, args) after_invocation(name, args, result) result end |