Sha256: 2187760b79a6099265686c4a8e8e37cebd4d8cb04cbb5ad64dcd781724df0777
Contents?: true
Size: 583 Bytes
Versions: 4
Compression:
Stored size: 583 Bytes
Contents
module Mongodb module Graphite module Agent module Utils def self.merge_all self.inject({}) { |h1, h2| h1.merge! h2 } end def self.json_descent(pre, json) json.map do |k, v| key = pre + [k] if v.is_a? BSON::OrderedHash json_descent(key, v) else {key.join('.') => v} end end end def self.to_hash(s) json_descent([], s).flatten.reduce Hash.new, :merge end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems