Sha256: 1638768e4a05778e699649836fb37b786a3bb25141f42121e977af45925f9332
Contents?: true
Size: 811 Bytes
Versions: 4
Compression:
Stored size: 811 Bytes
Contents
module Twitter module REST class FormEncoder UNESCAPED_CHARS = /[^a-z0-9\-._~]/i def self.encode(data) data.collect do |k, v| if v.nil? ::URI::DEFAULT_PARSER.escape(k.to_s, UNESCAPED_CHARS) elsif v.respond_to?(:to_ary) v.to_ary.collect do |w| str = ::URI::DEFAULT_PARSER.escape(k.to_s, UNESCAPED_CHARS) unless w.nil? str << "=" str << ::URI::DEFAULT_PARSER.escape(w.to_s, UNESCAPED_CHARS) end end.join("&") else str = ::URI::DEFAULT_PARSER.escape(k.to_s, UNESCAPED_CHARS) str << "=" str << ::URI::DEFAULT_PARSER.escape(v.to_s, UNESCAPED_CHARS) end end.join("&") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems