Method: HTTPClient::OAuth.escape
- Defined in:
- lib/httpclient/auth.rb
.escape(str) ⇒ Object
:nodoc:
736 737 738 739 740 741 742 743 744 745 746 |
# File 'lib/httpclient/auth.rb', line 736 def self.escape(str) # :nodoc: if str.respond_to?(:force_encoding) str.dup.force_encoding('BINARY').gsub(/([^a-zA-Z0-9_.~-]+)/) { '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase } else str.gsub(/([^a-zA-Z0-9_.~-]+)/n) { '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase } end end |