Sha256: c4943e686b8a06203823a8eec3af0766c600671e4d3c298d56e0754bcafaeb01

Contents?: true

Size: 723 Bytes

Versions: 17

Compression:

Stored size: 723 Bytes

Contents

class Errata
  class Erratum
    class Replace < Erratum
      attr_accessor :matching_expression, :correction
      
      def initialize(errata, options = {})
        super
        set_matching_expression(options)
        @correction = /\Aabbr\((.*)\)\z/.match(options[:x]) ? '\1' + options[:y].to_s + '\2' : options[:y].to_s
      end
      
      def inspect
        super + " matching_expression=#{matching_expression} correction=#{correction}>"
      end
      
      def correct!(row)
        super(row) do
          if matching_expression.blank?
            row[column] = correction
          else
            row[column].gsub!(matching_expression, correction)
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
seamusabshere-errata-0.1.0 lib/erratum/replace.rb
seamusabshere-errata-0.1.1 lib/erratum/replace.rb
seamusabshere-errata-0.1.2 lib/erratum/replace.rb
seamusabshere-errata-0.1.3 lib/erratum/replace.rb
seamusabshere-errata-0.1.4 lib/erratum/replace.rb
errata-0.2.4 lib/erratum/replace.rb
errata-ruby19-0.2.3 lib/erratum/replace.rb
errata-0.2.3 lib/erratum/replace.rb
errata-0.2.2 lib/erratum/replace.rb
errata-0.2.1 lib/erratum/replace.rb
errata-0.2.0 lib/erratum/replace.rb
errata-0.1.9 lib/erratum/replace.rb
errata-0.1.8 lib/erratum/replace.rb
errata-0.1.7 lib/erratum/replace.rb
errata-0.1.6 lib/erratum/replace.rb
errata-0.1.5 lib/erratum/replace.rb
errata-0.1.4 lib/erratum/replace.rb