Sha256: df4370a876fcc5fdb102db501fa0ef3b828fe0d41b6414b5e5f8065255568a1b

Contents?: true

Size: 534 Bytes

Versions: 3

Compression:

Stored size: 534 Bytes

Contents

# frozen_string_literal: true

module DepShield
  class Todos
    def initialize
      @todo_list = {}
    end

    def load(pathname)
      return unless File.exist?(pathname)

      list = YAML.load_file(pathname) || {}

      list.each do |feature_name, dep_todos|
        @todo_list[feature_name] ||= []
        @todo_list[feature_name] += dep_todos
      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

3 entries across 3 versions & 1 rubygems

Version Path
dep_shield-0.3.1 lib/dep_shield/todos.rb
dep_shield-0.3.0 lib/dep_shield/todos.rb
dep_shield-0.2.1 lib/dep_shield/todos.rb