vendor/bundle/ruby/2.1.0/gems/ice_nine-0.10.0/lib/ice_nine/support/recursion_guard.rb
# Guard against recursively calling a block with the same object
#
# @example
#   recursion_guard = IceNine::RecursionGuard.new
#   recursion_guard.guard(object_id) do
#     logic_which_may_be_recursively_called_with_object_id(recursion_guard)
#   end
#
# @param [Integer] caller_object_id
#
# @return [Object]
#
# @api public
Guard against recursively calling a block with the same object
Guard against recursively calling a block with the same object
def guard(caller_object_id)
      return if @object_ids.key?(caller_object_id)
      @object_ids[caller_object_id] = nil
      yield
    end
def guard ( caller_object_id ) return if @object_ids . key? ( caller_object_id ) @object_ids [ caller_object_id ] = nil yield end
Guard against recursively calling a block with the same object
Guard against recursively calling a block with the same object
None
Object
caller_object_id
None
example
recursion_guard = IceNine::RecursionGuard.new recursion_guard.guard(object_id) do logic_which_may_be_recursively_called_with_object_id(recursion_guard) end
recursion_guard = IceNine :: RecursionGuard . new recursion_guard . guard ( object_id ) do logic_which_may_be_recursively_called_with_object_id ( recursion_guard ) end
api
None