Flowdock
method

escape

Importance_0
v1_9_1_378 - Show latest stable - 0 notes - Class: Parser
escape(str, unsafe = @regexp[:UNSAFE]) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/uri/common.rb, line 214
    def escape(str, unsafe = @regexp[:UNSAFE])
      unless unsafe.kind_of?(Regexp)
        # perhaps unsafe is String object
        unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false)
      end
      str.gsub(unsafe) do
        us = $&
        tmp = ''
        us.each_byte do |uc|
          tmp << sprintf('%%%02X', uc)
        end
        tmp
      end.force_encoding(Encoding::US_ASCII)
    end
Register or log in to add new notes.