Class: IceNine::Freezer
- Inherits:
-
Object
- Object
- IceNine::Freezer
- Defined in:
- lib/ice_nine/freezer.rb,
lib/ice_nine/freezer/hash.rb,
lib/ice_nine/freezer/array.rb,
lib/ice_nine/freezer/range.rb,
lib/ice_nine/freezer/module.rb,
lib/ice_nine/freezer/object.rb,
lib/ice_nine/freezer/struct.rb,
lib/ice_nine/freezer/symbol.rb,
lib/ice_nine/freezer/numeric.rb,
lib/ice_nine/freezer/rubinius.rb,
lib/ice_nine/freezer/nil_class.rb,
lib/ice_nine/freezer/no_freeze.rb,
lib/ice_nine/freezer/hash/state.rb,
lib/ice_nine/freezer/true_class.rb,
lib/ice_nine/freezer/false_class.rb
Overview
The default class that handles freezing objects
Defined Under Namespace
Classes: Array, FalseClass, Hash, Module, NilClass, NoFreeze, Numeric, Object, Range, Rubinius, Struct, Symbol, TrueClass
Constant Summary collapse
- BasicObject =
Object
Object
Class Method Summary collapse
-
.[](mod) ⇒ Class<Freezer>
Look up the Freezer descendant by object type.
-
.const_lookup(namespace) ⇒ Module?
private
Look up a constant in the namespace.
-
.deep_freeze(object) ⇒ Object
Deep freeze an object with a particular Freezer.
-
.deep_freeze!(object) ⇒ Object
Deep freeze an object with a particular Freezer.
-
.guarded_deep_freeze(object, recursion_guard) ⇒ Object
private
Deep freeze an object with a particular Freezer and RecursionGuard.
Class Method Details
.[](mod) ⇒ Class<Freezer>
Look up the Freezer descendant by object type
27 28 29 |
# File 'lib/ice_nine/freezer.rb', line 27 def self.[](mod) @freezer_cache[mod] end |
.const_lookup(namespace) ⇒ Module?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Look up a constant in the namespace
86 87 88 |
# File 'lib/ice_nine/freezer.rb', line 86 def self.const_lookup(namespace) const_get(namespace) if const_defined?(namespace, nil) end |
.deep_freeze(object) ⇒ Object
Deep freeze an object with a particular Freezer
40 41 42 |
# File 'lib/ice_nine/freezer.rb', line 40 def self.deep_freeze(object) guarded_deep_freeze(object, RecursionGuard::ObjectSet.new) end |
.deep_freeze!(object) ⇒ Object
Deep freeze an object with a particular Freezer
53 54 55 |
# File 'lib/ice_nine/freezer.rb', line 53 def self.deep_freeze!(object) guarded_deep_freeze(object, RecursionGuard::Frozen.new) end |
.guarded_deep_freeze(object, recursion_guard) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deep freeze an object with a particular Freezer and RecursionGuard
98 99 100 101 102 |
# File 'lib/ice_nine/freezer.rb', line 98 def self.guarded_deep_freeze(object, recursion_guard) recursion_guard.guard(object) do Freezer[object.class].guarded_deep_freeze(object, recursion_guard) end end |