Sha256: efa657990d70ded563df88c03739fa22a5b8bc88077718b4d321b69f0b4fa92e

Contents?: true

Size: 881 Bytes

Versions: 2

Compression:

Stored size: 881 Bytes

Contents

# typed: strict
# frozen_string_literal: true

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

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

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

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
packwerk-2.0.0 lib/packwerk/node_processor_factory.rb
packwerk-1.4.0 lib/packwerk/node_processor_factory.rb