Class: Orthoses::ActiveSupport::CoreExt::Concerning

Inherits:
Object
  • Object
show all
Defined in:
lib/orthoses/active_support/core_ext.rb

Instance Method Summary collapse

Constructor Details

#initialize(loader) ⇒ Concerning

Returns a new instance of Concerning.



7
8
9
# File 'lib/orthoses/active_support/core_ext.rb', line 7

def initialize(loader)
  @loader = loader
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/orthoses/active_support/core_ext.rb', line 11

def call
  tracer = ::Orthoses::CallTracer::Lazy.new
  tracer.trace('Module::Concerning#concern') do
    @loader.call
  end.tap do |store|
    tracer.captures.each do |capture|
      base = capture.method.receiver
      base_name = ::Orthoses::Utils.module_name(base) or next
      topic = capture.argument[:topic] or next
      store["#{base_name}::#{topic}"].header = "module #{base_name}::#{topic}"
    end
  end
end