Method: Merb::Parse.escape

Defined in:
lib/merb-core/dispatch/request_parsers.rb

.escape(s) ⇒ Object

Parameters

s<String>

String to URL escape.

returns

String

The escaped string.

:api: public



187
188
189
190
191
# File 'lib/merb-core/dispatch/request_parsers.rb', line 187

def self.escape(s)
  s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
    '%'+$1.unpack('H2'*$1.size).join('%').upcase
  }.tr(' ', '+')
end