Sha256: db6fcfa81f8551cc0f25bd39fc2083f07f18172e1de8c4cb90064312a475ea37

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

require 'cgi'

module OpenTok
  module Utils
    # would recommend using `addressable` gem instead
    def self.urlencode_hash(hash)
      hash.to_a.map do |name_value|
        if name_value[1].is_a? Array
          name_value[0] = CGI.escape name_value[0].to_s
          name_value[1].map { |e| CGI.escape e.to_s }
          name_value[1] = name_value[1].join "&" + name_value[0] + "="
          name_value.join '='
        else
          name_value.map { |e| CGI.escape e.to_s }.join '='
        end
      end.join '&'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opentok-0.0.92 lib/open_tok/utils.rb
opentok-0.0.91 lib/open_tok/utils.rb
opentok-0.0.9 lib/open_tok/utils.rb
opentok-0.0.73 lib/open_tok/utils.rb