Module: Rack::Utils
- Defined in:
- lib/usher/util/rack-mixins.rb
Class Method Summary collapse
Class Method Details
.uri_escape(s) ⇒ Object
8 9 10 11 12 |
# File 'lib/usher/util/rack-mixins.rb', line 8 def uri_escape(s) s.to_s.gsub(/([^:\/?\[\]\-_~\.!\$&'\(\)\*\+,;=@a-zA-Z0-9]+)/n) { '%'<<$1.unpack('H2'*$1.size).join('%').upcase } end |
.uri_unescape(s) ⇒ Object
15 16 17 18 19 |
# File 'lib/usher/util/rack-mixins.rb', line 15 def uri_unescape(s) gsub(/((?:%[0-9a-fA-F]{2})+)/n){ [$1.delete('%')].pack('H*') } end |