Sha256: a4255d81f0423d60b2a392ae70bec61b1c06787d681ec9b5d55a85da3d5a267c

Contents?: true

Size: 681 Bytes

Versions: 29

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

module Orthoses
  class Walk
    def initialize(loader, root:)
      @loader = loader
      @root = root
    end

    def call
      @loader.call.tap do |store|
        root = Object.const_get(@root) if @root.instance_of?(String)
        Utils.module_name(root)&.then { |root_name| store[root_name] }
        Orthoses::Utils.each_const_recursive(root) do |current, const, val|
          if val.kind_of?(Module)
            Utils.module_name(val)&.then do |val_name|
              Orthoses.logger.debug("Add [#{val_name}] on #{__FILE__}:#{__LINE__}")
              store[val_name]
            end
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
orthoses-0.9.0 lib/orthoses/walk.rb
orthoses-0.8.0 lib/orthoses/walk.rb
orthoses-0.7.0 lib/orthoses/walk.rb
orthoses-0.6.0 lib/orthoses/walk.rb
orthoses-0.5.0 lib/orthoses/walk.rb
orthoses-0.4.0 lib/orthoses/walk.rb
orthoses-0.3.0 lib/orthoses/walk.rb
orthoses-0.2.0 lib/orthoses/walk.rb
orthoses-0.1.0 lib/orthoses/walk.rb