Module: Jeff::Utils
- Defined in:
- lib/jeff.rb
Overview
Because Ruby’s CGI escapes tilde, use a custom escape.
Constant Summary collapse
- UNRESERVED =
/([^\w.~-]+)/.freeze
Class Method Summary collapse
Class Method Details
.escape(val) ⇒ Object
83 84 85 86 87 88 |
# File 'lib/jeff.rb', line 83 def self.escape(val) val.to_s.gsub(UNRESERVED) do match = Regexp.last_match[1] "%#{match.unpack('H2' * match.bytesize).join('%')}".upcase end end |