Sha256: b3f18ac5490e046d47471d9bd45007b798546874bdee57c667ca1ba9dc80c62f

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

class Errata
  class Erratum
    class Replace < Erratum
      attr_reader :correction

      def initialize(responder, options = {})
        super
        @correction = if abbr?
          '\1' + options[:y].to_s + '\2'
        else
          options[:y].to_s
        end
      end

      def correct!(row)
        if targets? row
          if matching_expression.blank?
            row[section] = correction.dup
          else
            row[section].gsub! matching_expression, correction
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
errata-1.1.1 lib/errata/erratum/replace.rb
errata-1.1.0 lib/errata/erratum/replace.rb