Class: Errata::Erratum::Simplify
- Inherits:
-
Errata::Erratum
- Object
- Errata::Erratum
- Errata::Erratum::Simplify
- Defined in:
- lib/erratum/simplify.rb
Instance Attribute Summary collapse
-
#second_column ⇒ Object
Returns the value of attribute second_column.
Attributes inherited from Errata::Erratum
#column, #errata, #matching_method
Instance Method Summary collapse
- #correct!(row) ⇒ Object
-
#initialize(errata, options = {}) ⇒ Simplify
constructor
A new instance of Simplify.
- #inspect ⇒ Object
- #targets?(row) ⇒ Boolean
Constructor Details
#initialize(errata, options = {}) ⇒ Simplify
Returns a new instance of Simplify.
6 7 8 9 |
# File 'lib/erratum/simplify.rb', line 6 def initialize(errata, = {}) super @second_column = [:x] end |
Instance Attribute Details
#second_column ⇒ Object
Returns the value of attribute second_column.
4 5 6 |
# File 'lib/erratum/simplify.rb', line 4 def second_column @second_column end |
Instance Method Details
#correct!(row) ⇒ Object
19 20 21 22 23 |
# File 'lib/erratum/simplify.rb', line 19 def correct!(row) super(row) do row[column].gsub!(matching_expression(row), '') end end |
#inspect ⇒ Object
11 12 13 |
# File 'lib/erratum/simplify.rb', line 11 def inspect super + " second_column=#{second_column}>" end |
#targets?(row) ⇒ Boolean
15 16 17 |
# File 'lib/erratum/simplify.rb', line 15 def targets?(row) !row[column].blank? and !row[second_column].blank? and method_matches?(row) and matching_expression(row).match(row[column]) end |