class Addressable::URI

def self.form_unencode(encoded_value)

Returns:
  • (Array) -

Parameters:
  • encoded_value (String, #to_str) --
def self.form_unencode(encoded_value)
  if !encoded_value.respond_to?(:to_str)
    raise TypeError, "Can't convert #{encoded_value.class} into String."
  end
  encoded_value = encoded_value.to_str
  split_values = encoded_value.split("&").map do |pair|
    pair.split("=", 2)
  end
  return split_values.map do |(key, value)|
    [
      key ? self.unencode_component(
        key.gsub("+", "%20")).gsub(/(\r\n|\n|\r)/, "\n") : nil,
      value ? (self.unencode_component(
        value.gsub("+", "%20")).gsub(/(\r\n|\n|\r)/, "\n")) : nil
    ]
  end
end