Method: Cloudinary::Utils.encode_context

Defined in:
lib/cloudinary/utils.rb

.encode_context(hash) ⇒ String

Same like encode_hash, with additional escaping of | and = characters

Returns:

  • (String)

    a joined string of all keys and values properly escaped and separated by a pipe character



963
964
965
966
967
968
969
# File 'lib/cloudinary/utils.rb', line 963

def self.encode_context(hash)
  case hash
    when Hash then hash.map{|k,v| "#{k}=#{v.to_s.gsub(/([=|])/, '\\\\\1')}"}.join("|")
    when nil then ""
    else hash
  end
end