lib/rubocop/markdown/preprocess.rb in rubocop-md-1.2.2 vs lib/rubocop/markdown/preprocess.rb in rubocop-md-1.2.3
- old
+ new
@@ -37,13 +37,17 @@
#
# When autocorrect is applied, RuboCop re-writes the file
# using preproccessed source buffer.
#
# We have to restore it.
- def restore!(file)
+ def restore_and_save!(file)
contents = File.read(file)
- contents.gsub!(/^##{MARKER}/m, "")
+ restore!(contents)
File.write(file, contents)
+ end
+
+ def restore!(src)
+ src.gsub!(/^##{MARKER}/m, "")
end
end
attr_reader :config