module Trailblazer::Endpoint::Options::DSL

Public Class Methods

extended(extended) click to toggle source

Called in {Endpoint::Controller}.

# File lib/trailblazer/endpoint/options.rb, line 18
def self.extended(extended) # TODO: let's hope this is only called once per hierachy :)
  extended.instance_variable_set(:@normalizers, {})
end

Public Instance Methods

directive(directive_name, *callables, inherit: superclass) click to toggle source
# File lib/trailblazer/endpoint/options.rb, line 7
def directive(directive_name, *callables, inherit: superclass)
  options = {}

  if inherit
    options[:base_class] = instance_variable_get(:@normalizers)[directive_name] || Trailblazer::Activity::Path # FIXME
  end

  @normalizers[directive_name] = Trailblazer::Endpoint::Normalizer.Options(directive_name, *callables, **options) # DISCUSS: allow multiple calls?
end