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



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

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) ⇒ Object



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

def bind_action(name, options, &)
  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, &))
end