Module: ActionService::Router::ActionController

Defined in:
lib/action_service/router/action_controller.rb

Overview

:nodoc:

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.append_features(base) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/action_service/router/action_controller.rb', line 4

def self.append_features(base) # :nodoc:
  base.add_export_definition_callback do |klass, export_name, export_info|
    if klass.service_dispatching_mode == :direct && !klass.method_defined?(:api)
      klass.class_eval <<-EOS
        def api
          process_action_service_request
        end
      EOS
    end
  end
  base.add_service_definition_callback do |klass, name, info|
    if klass.service_dispatching_mode == :delegated
      klass.class_eval <<-EOS
        def #{name}
          process_action_service_request
        end
      EOS
    end
  end
  base.send(:include, ActionService::Router::ActionController::InstanceMethods)
end