Sha256: 914b288e1d943cce9f37d3c075d04dc5fc8bf40da112c2b47a3ff18eb48d537b

Contents?: true

Size: 788 Bytes

Versions: 16

Compression:

Stored size: 788 Bytes

Contents

# :stopdoc:

# Stolen from ruby core's uri/common.rb, with modifications to support 1.8.x
#
# https://github.com/ruby/ruby/blob/trunk/lib/uri/common.rb
#
#

module URI
  def self.encode_www_form(enum)
    enum.map do |k,v|
      if v.nil?
        encode_www_form_component(k)
      elsif v.respond_to?(:to_ary)
        v.to_ary.map do |w|
          str = encode_www_form_component(k)
          unless w.nil?
            str << '='
            str << encode_www_form_component(w)
          end
        end.join('&')
      else
        str = encode_www_form_component(k)
        str << '='
        str << encode_www_form_component(v)
      end
    end.join('&')
  end

  def self.encode_www_form_component(str)
    str.to_s.gsub(/[^*\-.0-9A-Z_a-z]/) { |chr| TBLENCWWWCOMP_[chr] }
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
elastic-site-search-3.0.1 lib/elastic/site-search/ext/backport-uri.rb
elastic-site-search-2.2.0 lib/elastic/site-search/ext/backport-uri.rb
elastic-site-search-2.1.0 lib/elastic/site-search/ext/backport-uri.rb
swiftype-1.5.2 lib/swiftype/ext/backport-uri.rb
swiftype-1.5.0 lib/swiftype/ext/backport-uri.rb
elastic-site-search-2.0.0 lib/elastic/site-search/ext/backport-uri.rb
swiftype-1.4.0 lib/swiftype/ext/backport-uri.rb
swiftype-1.3.1 lib/swiftype/ext/backport-uri.rb
swiftype-1.3.0 lib/swiftype/ext/backport-uri.rb
swiftype-1.2.3 lib/swiftype/ext/backport-uri.rb
swiftype-1.2.2 lib/swiftype/ext/backport-uri.rb
swiftype-1.2.1 lib/swiftype/ext/backport-uri.rb
swiftype-1.2.0 lib/swiftype/ext/backport-uri.rb
swiftype-1.1.0 lib/swiftype/ext/backport-uri.rb
swiftype-1.0.1 lib/swiftype/ext/backport-uri.rb
swiftype-1.0.0 lib/swiftype/ext/backport-uri.rb