Sha256: 642a57aec22f312ed0a5741677444df117c8ad68faee992a3ae4880291d3d301

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Graphwerk
  class DeprecatedReferencesLoader
    extend T::Sig

    sig { params(package: Packwerk::Package, root_path: Pathname).void }
    def initialize(package, root_path)
      @package = package
      @root_path = root_path
    end

    sig { returns(T::Array[String]) }
    def load
      return [] if !deprecated_references_file.exist?

      (YAML.load_file(deprecated_references_file) || {}).keys
    end

    private

    DEPRECATED_REFERENCES_FILENAME = 'deprecated_references.yml'

    sig { returns(Pathname) }
    def deprecated_references_file
      @deprecated_references_file = T.let(@deprecated_references_file, T.nilable(Pathname))
      @deprecated_references_file ||= @root_path.join(@package.name, DEPRECATED_REFERENCES_FILENAME)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphwerk-1.2.1 lib/graphwerk/deprecated_references_loader.rb
graphwerk-1.2.0 lib/graphwerk/deprecated_references_loader.rb