Class: Filecop::Runner
- Inherits:
-
Object
- Object
- Filecop::Runner
- Defined in:
- lib/filecop/runner.rb
Instance Method Summary collapse
-
#initialize(paths) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(paths) ⇒ Runner
Returns a new instance of Runner.
3 4 5 |
# File 'lib/filecop/runner.rb', line 3 def initialize(paths) @paths = paths end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/filecop/runner.rb', line 7 def run # load banned patterns from config file patterns = JSON.parse File.read(File.join(File.dirname(__FILE__), '..', 'patterns.json')) rules = patterns.map { |o| Rule.new(o) } output = [] @paths.each do |file| rules.each do |rule| if rule.matches?(file) output << { file: file, rule: rule } break end end end output end |