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


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

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