Class: FsUtils

Inherits:
Object show all
Defined in:
lib/ruby-fs-stack/fs_utils.rb

Class Method Summary collapse

Class Method Details

.querystring_from_hash(hash) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby-fs-stack/fs_utils.rb', line 4

def self.querystring_from_hash(hash)
  params = hash.map do |k,v|
    k = k.to_s
    if v.is_a? Hash
      v.collect do |k2,v2|
        k2 = k2.to_s
        v2 = v2.to_s
        v2 = url_encode(v2)
        "#{k}.#{k2}=#{v2}"
      end.join('&')
    else
      v = v.to_s
      v = self.url_encode(v)
      k + '=' + v
    end
  end
  params.join('&')
end