Rack::Typhoeus::Middleware::ParamsDecoder::Helper

Public Instance Methods

decode(hash) click to toggle source
# File lib/rack/typhoeus/middleware/params_decoder/helper.rb, line 36
def decode(hash)
  decode!(hash.dup)
end
decode!(hash) click to toggle source

Recursively decodes Typhoeus encoded arrays in given Hash.

@param hash [Hash]. This Hash will be modified!

@return [Hash] Hash with properly decoded nested arrays.

# File lib/rack/typhoeus/middleware/params_decoder/helper.rb, line 25
def decode!(hash)
  return hash unless hash.is_a?(Hash)
  hash.each_pair do |key,value|
    if value.is_a?(Hash)
      decode!(value)
      hash[key] = convert(value)
    end
  end
  hash
end
decode_typhoeus_arrays() click to toggle source

Recursively decodes Typhoeus encoded arrays in given Hash.

@example Use directly in a Rails controller.

class ApplicationController
   before_filter :decode_typhoeus_arrays
end

@author Dwayne Macgowan

# File lib/rack/typhoeus/middleware/params_decoder/helper.rb, line 16
def decode_typhoeus_arrays
  decode!(params)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.