Class: Errata::Erratum::Delete

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

Constant Summary

Constants inherited from Errata::Erratum

REJECT_ACTIONS, SEMICOLON_DELIMITER, SPECIAL_ABBR

Instance Attribute Summary collapse

Attributes inherited from Errata::Erratum

#matching_expression, #matching_methods, #responder, #section

Instance Method Summary collapse

Methods inherited from Errata::Erratum

#abbr?, #conditions_match?, #expression_matches?, #targets?

Constructor Details

#initialize(responder, options = {}) ⇒ Delete

Returns a new instance of Delete.



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

def initialize(responder, options = {})
  super
  # otherwise abbr(X) will kill the characters before and after the match
  @backfill = if abbr?
    '\1\2'
  else
    ''
  end
end

Instance Attribute Details

#backfillObject (readonly)

Returns the value of attribute backfill.



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

def backfill
  @backfill
end

Instance Method Details

#correct!(row) ⇒ Object



16
17
18
19
20
# File 'lib/errata/erratum/delete.rb', line 16

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