Sha256: 8633ce34922095c7eb2f138b0f94fae80d390953b22cbc928da4fa216f4dd580

Contents?: true

Size: 360 Bytes

Versions: 3

Compression:

Stored size: 360 Bytes

Contents

module Kong
  module Util
    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
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
kong-client-0.4.0 lib/kong/util.rb
kong-0.3.4 lib/kong/util.rb
kong-0.3.3 lib/kong/util.rb