Module: Trailblazer::Endpoint::Grape::Controller

Defined in:
lib/trailblazer/endpoint/grape/controller.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Make endpoint’s compile time methods available in ‘base` and instance methods available in it’s routes.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/trailblazer/endpoint/grape/controller.rb', line 9

def self.included(base)
  base.extend(Trailblazer::Endpoint::Controller)

  base.helpers(
    Trailblazer::Endpoint::Controller::InstanceMethods,
    Trailblazer::Endpoint::Controller::InstanceMethods::API
  )

  base.helpers do
    # Override `Controller::InstanceMethods#config_source` to return `base`
    # as the link between compile-time and run-time config.
    #
    # @api public
    define_method(:config_source, ->{ base })
  end
end