Module: Crashdesk::Reporters::QueryParams

Defined in:
lib/crashdesk/reporters/remote.rb

Class Method Summary collapse

Class Method Details

.encode(value, key = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/crashdesk/reporters/remote.rb', line 8

def self.encode(value, key = nil)
  case value
  when Hash  then value.map { |k,v| encode(v, append_key(key,k)) }.join('&')
  when Array then value.map { |v| encode(v, "#{key}[]") }.join('&')
  when nil   then ''
  else
    "#{key}=#{CGI.escape(value.to_s)}"
  end
end