Sha256: 57ac8dcf79c29f23fd4e577941bd9ed192916c4234d3b1750a50e9ea3ea839fa

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true
require 'as_deprecation_tracker/whitelist_entry'

module ASDeprecationTracker
  # Stores a list of known and ignored deprecation warnings, and provides a
  # query interface to check if a warning matches the list
  class Whitelist
    attr_reader :list

    def initialize
      @list = []
    end

    def add_to_list(entries)
      entries.each { |entry| @list << WhitelistEntry.new(entry) }
    end

    def clear
      @list.clear
    end

    def load_file(path)
      add_to_list(YAML.load(File.read(path)))
    end

    def matches?(deprecation)
      @list.any? { |entry| entry.matches?(deprecation) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
as_deprecation_tracker-1.0.0 lib/as_deprecation_tracker/whitelist.rb