Module: Core::Endpoint::BasicHandler::Actions::Bound

Defined in:
app/api/core/endpoint/basic_handler/actions/bound.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.delegate_to_bound_handler(name, target = name) ⇒ Object


7
8
9
10
11
12
13
14
# File 'app/api/core/endpoint/basic_handler/actions/bound.rb', line 7

def self.delegate_to_bound_handler(name, target = name)
  line = __LINE__ + 1
  class_eval("
    def bound_#{name}(name, *args, &block)
      _handler_for(name).#{target}(*args, &block)
    end
  ")
end

Instance Method Details

#bind_action(name, options, &block) ⇒ Object


2
3
4
5
# File 'app/api/core/endpoint/basic_handler/actions/bound.rb', line 2

def bind_action(name, options, &block)
  class_handler = Class.new(Handler).tap { |handler| self.class.const_set(options[:as].to_s.camelize, handler) }
  register_handler(options[:to], class_handler.new(self, name, options, &block))
end