Module: ActiveSupport::CoreExtensions::CGI::EscapeSkippingSlashes

Included in:
CGI
Defined in:
lib/active_support/core_ext/cgi/escape_skipping_slashes.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#escape_skipping_slashes(str) ⇒ Object



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

def 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