Module: Core::Endpoint::Base::ModelBehaviour

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


38
39
40
# File 'app/api/core/endpoint/base.rb', line 38

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

Instance Method Details

#model(&block) ⇒ Object


42
43
44
45
# File 'app/api/core/endpoint/base.rb', line 42

def model(&block)
  handler = Class.new(Handler).tap { |handler| const_set(:Model, handler) }.new(&block)
  self.model_handler = handler
end