Sha256: 1880d66b9fb0b3be4cb424b0d92cba8bb3da330f68777ef9b99be47a03964a04

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

class Errata
  class Erratum
    class Transform < Erratum
      ALLOWED_METHODS = %w{upcase downcase}

      attr_reader :string_method

      def initialize(responder, options = {})
        super
        @string_method = options[:y]
        raise %{[errata] Method "#{@string_method}" not allowed} unless ALLOWED_METHODS.include? @string_method
      end

      def correct!(row)
        if targets? row
          row[section].gsub!(matching_expression) { |match| match.send string_method }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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