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