Fixes, once and for all the deprecated usage of URI.escape & URI.encode
This commit is contained in:
@@ -4,9 +4,13 @@
|
|||||||
# See http://rosettacode.org/wiki/URL_encoding#Ruby and http://www.ruby-forum.com/topic/207489
|
# See http://rosettacode.org/wiki/URL_encoding#Ruby and http://www.ruby-forum.com/topic/207489
|
||||||
if RUBY_VERSION >= '1.9.2'
|
if RUBY_VERSION >= '1.9.2'
|
||||||
module URI
|
module URI
|
||||||
def self.escape(str)
|
extend self
|
||||||
URI.encode_www_form_component(str).gsub('+', '%20')
|
|
||||||
|
def escape(str)
|
||||||
|
URI::Parser.new.escape(str)
|
||||||
end
|
end
|
||||||
|
alias :encode :escape
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user