Module: Core::Endpoint::Base::InstanceBehaviour

Included in:
Core::Endpoint::Base
Defined in:
app/api/core/endpoint/base.rb

Defined Under Namespace

Classes: Handler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


11
12
13
# File 'app/api/core/endpoint/base.rb', line 11

def self.extended(base)
  base.class_attribute :instance_handler, instance_writer: false
end

Instance Method Details

#instance(&block) ⇒ Object


15
16
17
18
19
# File 'app/api/core/endpoint/base.rb', line 15

def instance(&block)
  handler = Class.new(Handler).tap { |handler| const_set(:Instance, handler) }.new(&block)
  handler.instance_variable_set(:@name, name)
  self.instance_handler = handler
end