Sha256: e5f46a3457ec425749cb7c8ab4cb6bd9ba1ef75e05dd7a8ff2ea8ef4df058cf2

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 Bytes

Contents

# frozen_string_literal: true

module Orthoses
  module ActiveSupport
    class Concern
      def initialize(loader)
        @loader = loader
      end

      def call
        target_method = begin
          ::ActiveSupport::Concern.method(:extended)
        rescue NameError => err
          Orthoses.logger.warn("Run `require 'active_support/concern'` and retry because #{err}")
          require 'active_support/concern'
          retry
        end

        extended = CallTracer.new
        store = extended.trace(target_method) do
          @loader.call
        end
        extended.result.each do |method, argument|
          base_name = Orthoses::Utils.module_name(argument[:base])
          next unless base_name
          store[argument[:base].to_s] << "extend ActiveSupport::Concern"
        end
        store
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orthoses-rails-0.3.0 lib/orthoses/active_support/concern.rb