Sha256: ca248f37d3d4161622b01dc4b1cd36bf4116dd8c8d94922230db1f8e111e10b2
Contents?: true
Size: 530 Bytes
Versions: 1
Compression:
Stored size: 530 Bytes
Contents
module NationBuilder::Utils module QueryParams module_function def encode(value, key = nil, output = {}) case value when Hash then value.each { |k, v| encode(v, append_key(key, k), output) } when Array then value.each { |v| encode(v, "#{key}[]", output) } when nil then '' else output[key] = value end output end def append_key(root_key, key) root_key.nil? ? "#{key}" : "#{root_key}[#{key}]" end private_class_method :append_key end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nationbuilder-rb-1.6.2 | lib/nationbuilder/utils.rb |