Module: Quickblox::HashConverter

Defined in:
lib/quickblox.rb

Class Method Summary collapse

Class Method Details

.encode(value, key = nil, out_hash = {}) ⇒ Object



929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
# File 'lib/quickblox.rb', line 929

def self.encode(value, key = nil, out_hash = {})
  case value
    when Hash then
      value.each { |k, v| encode(v, append_key(key, k), out_hash) }
      out_hash
    when Array then
      value.each { |v| encode(v, "#{key}[]", out_hash) }
      out_hash
    when nil then
      ''
    else
      out_hash[key] = value
      out_hash
  end
end