Class: Errata::Erratum::Simplify
- Inherits:
-
Errata::Erratum
- Object
- Errata::Erratum
- Errata::Erratum::Simplify
- Defined in:
- lib/errata/erratum/simplify.rb
Constant Summary
Constants inherited from Errata::Erratum
REJECT_ACTIONS, SEMICOLON_DELIMITER, SPECIAL_ABBR
Instance Attribute Summary collapse
-
#second_section ⇒ Object
readonly
Returns the value of attribute second_section.
Attributes inherited from Errata::Erratum
#matching_expression, #matching_methods, #responder, #section
Instance Method Summary collapse
- #correct!(row) ⇒ Object
-
#initialize(responder, options = {}) ⇒ Simplify
constructor
A new instance of Simplify.
- #targets?(row) ⇒ Boolean
Methods inherited from Errata::Erratum
#abbr?, #conditions_match?, #expression_matches?
Constructor Details
#initialize(responder, options = {}) ⇒ Simplify
Returns a new instance of Simplify.
6 7 8 9 |
# File 'lib/errata/erratum/simplify.rb', line 6 def initialize(responder, = {}) super @second_section = [:x] end |
Instance Attribute Details
#second_section ⇒ Object (readonly)
Returns the value of attribute second_section.
4 5 6 |
# File 'lib/errata/erratum/simplify.rb', line 4 def second_section @second_section end |
Instance Method Details
#correct!(row) ⇒ Object
15 16 17 18 19 |
# File 'lib/errata/erratum/simplify.rb', line 15 def correct!(row) if targets? row row[section].gsub! special_matcher(row), '' end end |
#targets?(row) ⇒ Boolean
11 12 13 |
# File 'lib/errata/erratum/simplify.rb', line 11 def targets?(row) !row[section].blank? and !row[second_section].blank? and conditions_match?(row) and special_matcher(row).match(row[section]) end |