Module: Refine::Object::Copy

Extended by:
Is::Localized
Defined in:
lib/refine/object/copy.rb

Constant Summary collapse

DEFAULT =
::Object.new

Class Method Summary collapse

Class Method Details

.copied_objectsObject



90
91
92
# File 'lib/refine/object/copy.rb', line 90

def copied_objects
  localized(:__corerb_copied_objects) || localize(:__corerb_copied_objects, {})
end

.copying?(object) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/refine/object/copy.rb', line 86

def copying?(object)
  copied_objects[object.object_id]
end

.prevent_recursion(object) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/refine/object/copy.rb', line 78

def prevent_recursion(object)
  copied_objects[object.object_id] = true

  yield
ensure
  copied_objects.delete(object.object_id)
end