Class: Errata::Erratum::Simplify
Instance Attribute Summary
#errata, #options
Instance Method Summary
collapse
#conditions_match?, #expression_matches?, #initialize, #matching_expression, #matching_methods, #responder, #section
Instance Method Details
#correct!(row) ⇒ Object
12
13
14
15
16
|
# File 'lib/errata/erratum/simplify.rb', line 12
def correct!(row)
if targets? row
row[section].gsub! special_matcher(row), ''
end
end
|
#second_section ⇒ Object
4
5
6
|
# File 'lib/errata/erratum/simplify.rb', line 4
def second_section
options['x']
end
|
#special_matcher(row) ⇒ Object
18
19
20
|
# File 'lib/errata/erratum/simplify.rb', line 18
def special_matcher(row)
/[\s\(\[\'\"]*#{::Regexp.escape(row[second_section])}[\s\)\]\'\"]*/
end
|
#targets?(row) ⇒ Boolean
8
9
10
|
# File 'lib/errata/erratum/simplify.rb', line 8
def targets?(row)
!row[section].blank? and !row[second_section].blank? and conditions_match?(row) and special_matcher(row).match(row[section])
end
|