Class: DepShield::Todos
- Inherits:
-
Object
- Object
- DepShield::Todos
- Defined in:
- lib/dep_shield/todos.rb
Instance Method Summary collapse
- #allowed?(name, stack) ⇒ Boolean
-
#initialize ⇒ Todos
constructor
A new instance of Todos.
- #load(pathname) ⇒ Object
Constructor Details
#initialize ⇒ Todos
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
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 |