Module: Typhoeus::Utils
- Defined in:
- lib/typhoeus/utils.rb
Class Method Summary collapse
- .bytesize(string) ⇒ Object
-
.escape(s) ⇒ Object
Taken from Rack::Utils, 1.2.1 to remove Rack dependency.
Class Method Details
.bytesize(string) ⇒ Object
14 15 16 |
# File 'lib/typhoeus/utils.rb', line 14 def bytesize(string) string.bytesize end |
.escape(s) ⇒ Object
Taken from Rack::Utils, 1.2.1 to remove Rack dependency.
4 5 6 7 8 |
# File 'lib/typhoeus/utils.rb', line 4 def escape(s) s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/) { '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase }.tr(' ', '+') end |