Sha256: 6e3a8491be5d118d86b18d3d06eab0f62d168a2dffec16eeda1431ffa365f69b

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

# typed: strict
# frozen_string_literal: true

require "packwerk/constant_name_inspector"
require "packwerk/checker"

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

    const :root_path, String
    const :reference_lister, ReferenceLister
    const :context_provider, Packwerk::ConstantDiscovery
    const :constant_name_inspectors, T::Array[ConstantNameInspector]
    const :checkers, T::Array[Checker]

    sig { params(filename: String, node: AST::Node).returns(NodeProcessor) }
    def for(filename:, node:)
      ::Packwerk::NodeProcessor.new(
        reference_extractor: reference_extractor(node: node),
        reference_lister: reference_lister,
        filename: filename,
        checkers: checkers,
      )
    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

5 entries across 5 versions & 1 rubygems

Version Path
packwerk-1.1.3 lib/packwerk/node_processor_factory.rb
packwerk-1.1.2 lib/packwerk/node_processor_factory.rb
packwerk-1.1.1 lib/packwerk/node_processor_factory.rb
packwerk-1.1.0 lib/packwerk/node_processor_factory.rb
packwerk-1.0.2 lib/packwerk/node_processor_factory.rb