Module: Kong::Util
- Defined in:
- lib/kong/util.rb
Class Method Summary collapse
Class Method Details
.flatten(cursor, parent_key = nil, memo = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/kong/util.rb', line 3 def self.flatten(cursor, parent_key = nil, memo = {}) memo.tap do case cursor when Hash cursor.keys.each do |key| flatten(cursor[key], [parent_key, key].compact.join('.'), memo) end else memo["#{parent_key}"] = cursor end end end |