Class: DepShield::Todos

Inherits:
Object
  • Object
show all
Defined in:
lib/dep_shield/todos.rb

Instance Method Summary collapse

Constructor Details

#initializeTodos

Returns a new instance of Todos.



5
6
7
# File 'lib/dep_shield/todos.rb', line 5

def initialize
  @todo_list = {}
end

Instance Method Details

#allowed?(name, stack) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/dep_shield/todos.rb', line 20

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

#load(pathname) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/dep_shield/todos.rb', line 9

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