Sha256: 8e7cf59a67384eeb09bbc43efb33e13e1f64e859e66f17491f5824cfeea303e7
Contents?: true
Size: 689 Bytes
Versions: 6
Compression:
Stored size: 689 Bytes
Contents
# encoding: utf-8 module IceNine class Freezer # A freezer class for handling Hash objects class Hash < Object # Deep Freeze a Hash # # @example # hash = IceNine::Freezer::Hash.deep_freeze('a' => '1', 'b' => '2') # hash.keys.select(&:frozen?) # => ['a', 'b'] # hash.values.select(&:frozen?) # => ['1', '2'] # # @param [Hash] hash # # @return [Hash] # # @api public def self.deep_freeze(hash) super hash.each { |key, value| IceNine.deep_freeze(key) IceNine.deep_freeze(value) } end end # class Hash end # class Freezer end # module IceNine
Version data entries
6 entries across 6 versions & 1 rubygems