Sha256: ec86628cb1e1ba44b9dd8de4576fe1cbfa156825bc96d2e37ab7e1ea7c05bbbb
Contents?: true
Size: 839 Bytes
Versions: 10
Compression:
Stored size: 839 Bytes
Contents
class Errata class Erratum class Simplify < Erratum attr_accessor :second_column def initialize(errata, options = {}) super @second_column = options[:x] end def inspect super + " second_column=#{second_column}>" end def targets?(row) !row[column].blank? and !row[second_column].blank? and method_matches?(row) and matching_expression(row).match(row[column]) end def correct!(row) super(row) do row[column].gsub!(matching_expression(row), '') end end private def matching_expression(row) @_matching_expressions ||= {} @_matching_expressions[row[second_column]] ||= /[\s\(\[\'\"]*#{Regexp.escape(row[second_column])}[\s\)\]\'\"]*/ end end end end
Version data entries
10 entries across 10 versions & 2 rubygems