Class: RSpectre::AutoCorrector
- Inherits:
-
Parser::Rewriter
- Object
- Parser::Rewriter
- RSpectre::AutoCorrector
- Defined in:
- lib/rspectre/auto_corrector.rb
Instance Method Summary collapse
Instance Method Details
#correct ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/rspectre/auto_corrector.rb', line 7 def correct buffer = Parser::Source::Buffer.new("(#{filename})") buffer.source = File.read(filename) File.open(filename, 'w') do |file| file.write(rewrite(buffer, Parser::CurrentRuby.new.parse(buffer))) end end |
#on_block(node) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rspectre/auto_corrector.rb', line 16 def on_block(node) remove(node.location.expression) if nodes.any? do |offense_node| node == offense_node && node.location.line == offense_node.location.line end super end |