Module: Core::State

Extended by:
Extension, Local
Defined in:
lib/core/state.rb,
lib/core/state/version.rb

Overview

public

Make objects stateful.

Constant Summary collapse

ALLOWED_FLAGS =
%i[class instance].freeze
VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.copied_objectsObject



228
229
230
# File 'lib/core/state.rb', line 228

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

.copying?(object) ⇒ Boolean

Returns:

  • (Boolean)


224
225
226
# File 'lib/core/state.rb', line 224

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

.prevent_recursion(object) ⇒ Object



216
217
218
219
220
221
222
# File 'lib/core/state.rb', line 216

def prevent_recursion(object)
  object_id = object.object_id
  copied_objects[object_id] = true
  yield
ensure
  copied_objects.delete(object_id)
end

.versionObject



7
8
9
# File 'lib/core/state/version.rb', line 7

def self.version
  VERSION
end