# File lib/escape.rb, line 92 92: def uri_segment(str) 93: # pchar - pct-encoded = unreserved / sub-delims / ":" / "@" 94: # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" 95: # sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" 96: str.gsub(%r{[^A-Za-z0-9\-._~!$&'()*+,;=:@]}n) { 97: '%' + $&.unpack("H2")[0].upcase 98: } 99: end