Class: IceNine::Freezer::Object

Inherits:
IceNine::Freezer show all
Defined in:
lib/ice_nine/freezer/object.rb

Overview

A freezer class for handling Object instances

Direct Known Subclasses

Array, Hash, Range

Constant Summary

Constants inherited from IceNine::Freezer

BasicObject

Class Method Summary collapse

Methods inherited from IceNine::Freezer

[], const_lookup, deep_freeze, deep_freeze!

Class Method Details

.guarded_deep_freeze(object, recursion_guard) ⇒ Object

Deep Freeze an object

Examples:

object = IceNine.deep_freeze(Object.new)

Parameters:

Returns:



18
19
20
21
22
23
24
# File 'lib/ice_nine/freezer/object.rb', line 18

def self.guarded_deep_freeze(object, recursion_guard)
  return object unless object.respond_to?(:freeze)

  object.freeze
  freeze_instance_variables(object, recursion_guard)
  object
end