Class: IceNine::Freezer

Inherits:
Object
  • Object
show all
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/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

Direct Known Subclasses

NoFreeze, Object

Defined Under Namespace

Classes: Array, FalseClass, Hash, NilClass, NoFreeze, Numeric, Object, Range, Rubinius, Struct, Symbol, TrueClass

Constant Summary collapse

SKIP_ANCESTORS =

Configure const_get and const_defined? to not search ancestors

(RUBY_VERSION < '1.9' ? [] : [false]).freeze
BasicObject =

class Object

Object

Class Method Summary collapse

Class Method Details

.[](mod) ⇒ Class<Freezer>

Look up the Freezer descendant by object type

Examples:

freezer_class = IceNine::Freezer[mod]

Parameters:

  • mod (Module)

Returns:



29
30
31
# File 'lib/ice_nine/freezer.rb', line 29

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

Parameters:

  • namespace (String)

Returns:

  • (Module)

    returned if a matching constant is found

  • (nil)

    returned if no matching constant is found



62
63
64
65
66
# File 'lib/ice_nine/freezer.rb', line 62

def self.const_lookup(namespace)
  if const_defined?(namespace, *SKIP_ANCESTORS)
    const_get(namespace, *SKIP_ANCESTORS)
  end
end