Class: Errata::Erratum::Delete

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

Instance Attribute Summary collapse

Attributes inherited from Errata::Erratum

#column, #errata, #options

Instance Method Summary collapse

Methods inherited from Errata::Erratum

#conditions_match?, #expression_matches?, #matching_methods, #set_matching_expression, #targets?

Constructor Details

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

Returns a new instance of Delete.



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

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

Instance Attribute Details

#backfillObject

Returns the value of attribute backfill.



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

def backfill
  @backfill
end

#matching_expressionObject

Returns the value of attribute matching_expression.



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

def matching_expression
  @matching_expression
end

Instance Method Details

#correct!(row) ⇒ Object



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

def correct!(row)
  super(row) do
    row[column].gsub!(matching_expression, backfill)
  end
end

#inspectObject



13
14
15
# File 'lib/erratum/delete.rb', line 13

def inspect
  super + " matching_expression=#{matching_expression}>"
end