lib/mongodb/graphite/agent/utils.rb in mongodb-graphite-agent-0.1.1 vs lib/mongodb/graphite/agent/utils.rb in mongodb-graphite-agent-0.1.2

- old
+ new

@@ -1,29 +1,29 @@ -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 +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