Method: Fog::OpenStack.escape

Defined in:
lib/fog/openstack.rb

.escape(str, extra_exclude_chars = '') ⇒ Object

CGI.escape, but without special treatment on spaces



95
96
97
98
99
# File 'lib/fog/openstack.rb', line 95

def self.escape(str, extra_exclude_chars = '')
  str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
    '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
  end
end