Class: CGI

Inherits:
Object show all
Defined in:
lib/active_support/core_ext/cgi/escape_skipping_slashes.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.escape_skipping_slashes(str) ⇒ Object


5
6
7
8
9
10
# File 'lib/active_support/core_ext/cgi/escape_skipping_slashes.rb', line 5

def self.escape_skipping_slashes(str)
  str = str.join('/') if str.respond_to? :join
  str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do
    "%#{$1.unpack('H2' * $1.bytesize).join('%').upcase}"
  end.tr(' ', '+')
end