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

Included in:
CGI
Defined in:
lib/gems/activesupport-2.2.2/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/gems/activesupport-2.2.2/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