Module: Jets::Mega::HashConverter
- Defined in:
- lib/jets/mega/hash_converter.rb
Class Method Summary collapse
Class Method Details
.encode(value, key = nil, out_hash = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jets/mega/hash_converter.rb', line 4 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 |