Class: Errata::Erratum::Truncate

Inherits:
Errata::Erratum show all
Defined in:
lib/erratum/truncate.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 = {}) ⇒ Truncate

Returns a new instance of Truncate.



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

def initialize(errata, options = {})
  super
  @necessary_and_sufficient_prefix = options[:x]
  raise "necessary_and_sufficient_prefix cannot be blank" if @necessary_and_sufficient_prefix.blank?
  set_matching_expression(options.merge(:prefix => true))
end

Instance Attribute Details

#matching_expressionObject

Returns the value of attribute matching_expression.



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

def matching_expression
  @matching_expression
end

#necessary_and_sufficient_prefixObject

Returns the value of attribute necessary_and_sufficient_prefix.



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

def necessary_and_sufficient_prefix
  @necessary_and_sufficient_prefix
end

Instance Method Details

#correct!(row) ⇒ Object



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

def correct!(row)
  super(row) do
    row[column] = necessary_and_sufficient_prefix
  end
end

#inspectObject



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

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