Module: URI::Escape

Defined in:
lib/atig/url_escape.rb

Instance Method Summary collapse

Instance Method Details

#_orig_escapeObject



39
# File 'lib/atig/url_escape.rb', line 39

alias :_orig_escape :escape

#encode_component(str, unsafe = ::OAuth::RESERVED_CHARACTERS) ⇒ Object



51
52
53
# File 'lib/atig/url_escape.rb', line 51

def encode_component(str, unsafe = ::OAuth::RESERVED_CHARACTERS)
  _orig_escape(str, unsafe).tr(" ", "+")
end

#escape(str, unsafe = %r{[^-_.!~*'()a-zA-Z0-9;/?:@&=+$,\[\]]}) ⇒ Object Also known as: encode

URI(“file:///4”) #=> #<URI::Generic:0x9d09db0 URL:file:/4>

"\\d" -> "[0-9]" for Ruby 1.9


45
46
47
# File 'lib/atig/url_escape.rb', line 45

def escape str, unsafe = %r{[^-_.!~*'()a-zA-Z0-9;/?:@&=+$,\[\]]} #'
  _orig_escape(str, unsafe)
end

#rstrip(str) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/atig/url_escape.rb', line 55

def rstrip str
str.sub(%r{
	(?: ( / [^/?#()]* (?: \( [^/?#()]* \) [^/?#()]* )* ) \) [^/?#()]*
	  | \.
	) \z
}x, "\\1")
end