Class: DontComment::Runner
- Inherits:
-
Object
- Object
- DontComment::Runner
- Defined in:
- lib/dont_comment/runner.rb
Instance Method Summary collapse
-
#initialize(files) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(files) ⇒ Runner
Returns a new instance of Runner.
3 4 5 |
# File 'lib/dont_comment/runner.rb', line 3 def initialize(files) @files = files end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dont_comment/runner.rb', line 7 def run # TODO: configuralbe ruby version parser_class = Parser::CurrentRuby @files.map do |fname| parser = parser_class.new buffer = buffer(fname) locs = comment_locations(parser, buffer) ruby_code_locs = locs.select do |loc| text = to_text(loc) parsable?(parser_class, text) && like_ruby_code?(text) end ruby_code_locs.map{|loc| Offense.new(loc, fname)} end.flatten end |