Class: IceNine::RecursionGuard::Frozen

Inherits:
IceNine::RecursionGuard show all
Defined in:
lib/ice_nine/support/recursion_guard.rb

Overview

Protects against infinite recursion by not yielding with frozen objects

Instance Method Summary collapse

Instance Method Details

#guard(object) ⇒ Object

Guard against recursively calling a block with the same frozen object

Parameters:

  • object (Object)

Returns:

  • (Object)


49
50
51
52
# File 'lib/ice_nine/support/recursion_guard.rb', line 49

def guard(object)
  return object if object.frozen?
  yield
end