Sha256: 477ab70c834a8e471870e1e65724141a7bd84a6ba16a6a13bcdb59a36f6ff250

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

class Errata
  class Erratum
    class Simplify < Erratum
      def second_section
        options['x']
      end

      def targets?(row)
        !row[section].blank? and !row[second_section].blank? and conditions_match?(row) and special_matcher(row).match(row[section])
      end
      
      def correct!(row)
        if targets? row
          row[section].gsub! special_matcher(row), ''
        end
      end
      
      def special_matcher(row)
        /[\s\(\[\'\"]*#{::Regexp.escape(row[second_section])}[\s\)\]\'\"]*/
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
errata-1.0.3 lib/errata/erratum/simplify.rb
errata-1.0.2 lib/errata/erratum/simplify.rb