Module: Trailblazer::Endpoint::Controller::InstanceMethods::DSL

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

Instance Method Summary collapse

Instance Method Details

#endpoint(name, **action_options, &block) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/trailblazer/endpoint/controller.rb', line 133

def endpoint(name, **action_options, &block)
  action_options = {controller: self}.merge(action_options) # FIXME: redundant with {API#endpoint}

  endpoint = endpoint_for(name)

  # raise name.inspect unless block_given?
  # TODO: check {dsl: false}
  # unless block_given? # FIXME
  #   config_source = self.class # FIXME
  #   block_options = config_source.options_for(:options_for_block_options, **action_options)
  #   block_options = Trailblazer::Endpoint::Options.merge_with(action_options, block_options)

  #   signal, (ctx, _) = Trailblazer::Endpoint::Controller.advance_endpoint_for_controller(
  #     endpoint:       endpoint,
  #     block_options:  block_options,
  #     config_source:  config_source,
  #     **action_options
  #   )

  #   return ctx
  # end


  invoke_endpoint_with_dsl(endpoint: endpoint, **action_options, &block)
end

#invoke_endpoint_with_dsl(options, &block) ⇒ Object



159
160
161
# File 'lib/trailblazer/endpoint/controller.rb', line 159

def invoke_endpoint_with_dsl(options, &block)
  _dsl = Trailblazer::Endpoint::DSL::Runtime.new(options, block) # provides #Or etc, is returned to {Controller#call}
end