lib/framework/utils/utils.rb in facter-4.0.8.pre vs lib/framework/utils/utils.rb in facter-4.0.9.pre
- old
+ new
@@ -18,7 +18,20 @@
def self.split_user_query(user_query)
queries = user_query.split('.')
queries.map! { |query| query =~ /^[0-9]+$/ ? query.to_i : query }
end
+
+ def self.deep_stringify_keys(object)
+ case object
+ when Hash
+ object.each_with_object({}) do |(key, value), result|
+ result[key.to_s] = deep_stringify_keys(value)
+ end
+ when Array
+ object.map { |e| deep_stringify_keys(e) }
+ else
+ object
+ end
+ end
end
end