Class: RubocopChallenger::Rubocop::TodoWriter
- Inherits:
-
Object
- Object
- RubocopChallenger::Rubocop::TodoWriter
- Defined in:
- lib/rubocop_challenger/rubocop/todo_writer.rb
Overview
To edit ‘.rubocop_todo.yml`
Instance Method Summary collapse
- #delete_rule(rubocop_rule) ⇒ Object
-
#initialize(source, destination = source) ⇒ TodoWriter
constructor
A new instance of TodoWriter.
Constructor Details
#initialize(source, destination = source) ⇒ TodoWriter
Returns a new instance of TodoWriter.
7 8 9 10 |
# File 'lib/rubocop_challenger/rubocop/todo_writer.rb', line 7 def initialize(source, destination = source) @source = source @destination = destination end |
Instance Method Details
#delete_rule(rubocop_rule) ⇒ Object
12 13 14 15 16 |
# File 'lib/rubocop_challenger/rubocop/todo_writer.rb', line 12 def delete_rule(rubocop_rule) current_data = File.read(source) contents = current_data.sub("\n#{rubocop_rule.contents}", '') File.write(destination, contents) end |