Sha256: 50a38c7fcf77e988f36274fa6b3c7c0875b73abbe30647245b295f410a200c15

Contents?: true

Size: 780 Bytes

Versions: 9

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

if defined?(ActiveJob::Base)
  ActiveJob::Base.class_eval do
    unless method_defined?(:remove_reserved_keywords)
      # Removes any reserved keywords that can't be passed along.
      #
      # @param arguments [...]
      #
      # @return [String, Numeric, Hash, Array, nil]
      #
      def remove_reserved_keywords(arguments)
        case arguments
        when String, Numeric
          arguments
        when Hash
          arguments.each_with_object({}) do |(key, value), obj|
            next if key.start_with?('_aj')

            obj[key] = remove_reserved_keywords(value)
          end
        when Array
          arguments.map do |arg|
            remove_reserved_keywords(arg)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-rails-extensions-1.1.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-1.1.1.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-0.2.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-0.2.0.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-1.1.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-1.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-0.1.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-1.0.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-1.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb