Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/zmb/utils.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) to_query_string



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/zmb/utils.rb', line 113

def to_query_string
  map { |k, v| 
    if v.instance_of?(Hash)
      v.map { |sk, sv|
        "#{k}[#{sk}]=#{CGI.escape(sv)}"
      }.join('&')
    else
      "#{k}=#{CGI.escape(v)}"
    end
  }.join('&')
end