Sha256: 7ce03cb96b7b2a27d7c5944e1d76d22cddfc81188a7467dcbe85e4d9cd79e765

Contents?: true

Size: 853 Bytes

Versions: 6

Compression:

Stored size: 853 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Packwerk
  class NodeProcessorFactory < T::Struct
    extend T::Sig

    const :root_path, String
    const :context_provider, ConstantDiscovery
    const :constant_name_inspectors, T::Array[ConstantNameInspector]

    sig { params(relative_file: String, node: AST::Node).returns(NodeProcessor) }
    def for(relative_file:, node:)
      NodeProcessor.new(
        reference_extractor: reference_extractor(node: node),
        relative_file: relative_file,
      )
    end

    private

    sig { params(node: AST::Node).returns(ReferenceExtractor) }
    def reference_extractor(node:)
      ReferenceExtractor.new(
        constant_name_inspectors: constant_name_inspectors,
        root_node: node,
        root_path: root_path,
      )
    end
  end

  private_constant :NodeProcessorFactory
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
packwerk-3.2.2 lib/packwerk/node_processor_factory.rb
packwerk-3.2.1 lib/packwerk/node_processor_factory.rb
packwerk-3.2.0 lib/packwerk/node_processor_factory.rb
packwerk-3.1.0 lib/packwerk/node_processor_factory.rb
packwerk-3.0.1 lib/packwerk/node_processor_factory.rb
packwerk-3.0.0 lib/packwerk/node_processor_factory.rb