Sha256: 24ea57cde3047b935329567355c8d15f3ddb3607e904af7ca28c2e815ae8ac4b
Contents?: true
Size: 494 Bytes
Versions: 7
Compression:
Stored size: 494 Bytes
Contents
require 'rack' unless Rack::Utils.respond_to?(:uri_escape) module Rack module Utils def uri_escape(s) s.to_s.gsub(/([^:\/?\[\]\-_~\.!\$&'\(\)\*\+,;=@a-zA-Z0-9]+)/n) { '%'<<$1.unpack('H2'*$1.size).join('%').upcase }.tr(' ', '+') end module_function :uri_escape def uri_unescape(s) gsub(/((?:%[0-9a-fA-F]{2})+)/n){ [$1.delete('%')].pack('H*') } end module_function :uri_unescape end end end
Version data entries
7 entries across 7 versions & 2 rubygems