Class: Punchlist::Inspector
- Inherits:
-
Object
- Object
- Punchlist::Inspector
- Defined in:
- lib/punchlist/inspector.rb
Overview
Inspects files for punchlist items
Instance Method Summary collapse
-
#initialize(punchlist_line_regexp, filename, file_opener: File) ⇒ Inspector
constructor
A new instance of Inspector.
-
#run ⇒ Array<Offense>
Punchlist items for the specified file.
Constructor Details
#initialize(punchlist_line_regexp, filename, file_opener: File) ⇒ Inspector
Returns a new instance of Inspector.
11 12 13 14 15 16 17 |
# File 'lib/punchlist/inspector.rb', line 11 def initialize(punchlist_line_regexp, filename, file_opener: File) @file_opener = file_opener @punchlist_line_regexp = punchlist_line_regexp @filename = filename @lines = [] @line_num = 0 end |
Instance Method Details
#run ⇒ Array<Offense>
Returns punchlist items for the specified file.
20 21 22 23 24 25 |
# File 'lib/punchlist/inspector.rb', line 20 def run @file_opener.open(filename, 'r') do |file| file.each_line { |line| inspect_line(line) } end @lines end |