Sha256: 2be67b394549b756fa696456de23611870395ddc9913d86a6d931eca0914ce78
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
require "celsius/version" require "deep_merger" module Celsius require "celsius/adapter" def self.deep_clone(object) Marshal.load(Marshal.dump(object)) end def self.deep_merge!(destination, source, options = {}) DeepMerger.deep_merge!(source, destination, options) end def self.deep_stringify_keys(hash) Celsius.deep_stringify_keys!(Celsius.deep_clone(hash)) end # private # # http://stackoverflow.com/questions/8379596/how-do-i-convert-a-ruby-hash-so-that-all-of-its-keys-are-symbols def self.deep_stringify_keys!(hash_or_element) case hash_or_element when Hash Hash[ hash_or_element.map do |key, value| [ key.respond_to?(:to_s) ? key.to_s : key, deep_stringify_keys(value) ] end ] when Enumerable hash_or_element.map { |value| deep_stringify_keys(value) } else hash_or_element end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
celsius-0.2.0 | lib/celsius.rb |