Sha256: bfb0f53feede0efeda35373ec0ec1c42834089c0b9bcc5c2e66b065b815df51b

Contents?: true

Size: 676 Bytes

Versions: 24

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true

if defined?(ActiveJob::Base)
  ActiveJob::Base.class_eval do
    # 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

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
ruby-rails-extensions-2.1.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.14 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.13 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.12 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.11 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.10 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.9 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.8 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.7 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.6 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.5 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.4 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.3 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.2 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.0.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.0.1.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.0.0 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
ruby-rails-extensions-2.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb