Class: Errata::Erratum::Delete

Inherits:
Errata::Erratum show all
Defined in:
lib/errata/erratum/delete.rb

Instance Attribute Summary

Attributes inherited from Errata::Erratum

#errata, #options

Instance Method Summary collapse

Methods inherited from Errata::Erratum

#conditions_match?, #expression_matches?, #initialize, #matching_expression, #matching_methods, #responder, #section, #targets?

Constructor Details

This class inherits a constructor from Errata::Erratum

Instance Method Details

#backfillObject


4
5
6
7
# File 'lib/errata/erratum/delete.rb', line 4

def backfill
  # otherwise abbr(X) will kill the characters before and after the match
  @backfill ||= /\Aabbr\((.*)\)\z/.match(options['x']) ? '\1\2' : ''
end

#correct!(row) ⇒ Object


9
10
11
12
13
# File 'lib/errata/erratum/delete.rb', line 9

def correct!(row)
  if targets? row
    row[section].gsub! matching_expression, backfill
  end
end