class RubocopChallenger::Rubocop::TodoWriter

To edit `.rubocop_todo.yml`

Attributes

destination[R]
source[R]

Public Class Methods

new(source, destination = source) click to toggle source
# File lib/rubocop_challenger/rubocop/todo_writer.rb, line 7
def initialize(source, destination = source)
  @source = source
  @destination = destination
end

Public Instance Methods

delete_rule(rubocop_rule) click to toggle source
# 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