Sha256: 769758431a90c4a449639320b85f31bda88cdde927a3eeb7f6e1c9ff26ce6bf6
Contents?: true
Size: 948 Bytes
Versions: 4
Compression:
Stored size: 948 Bytes
Contents
# encoding: utf-8 module IceNine class Freezer # A freezer class for handling Object instances class Object < self # Deep Freeze an object # # @example # object = IceNine.deep_freeze(Object.new) # # @param [Object] object # # @return [Object] # # @api public def self.deep_freeze(object) freeze_instance_variables(object) object.freeze end # Handle freezing the object's instance variables # # @param [Object] object # # @return [undefined] # # @api private def self.freeze_instance_variables(object) object.instance_variables.each do |ivar_name| IceNine.deep_freeze(object.instance_variable_get(ivar_name)) end end private_class_method :freeze_instance_variables end # class Object BasicObject = Object end # class Freezer end # module IceNine
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ice_nine-0.9.0 | lib/ice_nine/freezer/object.rb |
ice_nine-0.8.0 | lib/ice_nine/freezer/object.rb |
ice_nine-0.7.0 | lib/ice_nine/freezer/object.rb |
ice_nine-0.6.0 | lib/ice_nine/freezer/object.rb |