Method: Cloudinary::Utils.smart_escape

Defined in:
lib/cloudinary/utils.rb

.smart_escape(string, unsafe = /([^a-zA-Z0-9_.\-\/:]+)/) ⇒ Object

Based on CGI::escape. In addition does not escape / :



902
903
904
905
906
# File 'lib/cloudinary/utils.rb', line 902

def self.smart_escape(string, unsafe = /([^a-zA-Z0-9_.\-\/:]+)/)
  string.gsub(unsafe) do |m|
    '%' + m.unpack('H2' * m.bytesize).join('%').upcase
  end
end