Sha256: b69bf068e6096724004ffeced4f0f98a850dc3ec0bf8bfdcdec87ec7bd733104

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

module DepShield
  class Todos
    def todo_list
      @todo_list ||= begin
        paths = Rails.root.glob("**/.deprecation_todo.yml")

        paths.each_with_object({}) do |path, list|
          YAML.load_file(path)&.each do |feature_name, dep_todos|
            list[feature_name] ||= []
            list[feature_name] += dep_todos
          end
        end
      end
    end

    def allowed?(name, stack)
      todo_list.fetch(name, []).any? do |allowed_file|
        stack.join("\n").include? allowed_file
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dep_shield-0.1.1 lib/dep_shield/todos.rb