Module: Mongoid::Threaded::Lifecycle
Overview
This module contains convenience methods for document lifecycle that resides on thread locals.
Instance Attribute Summary
-
#_assigning ⇒ Object
readonly
private
Begin the assignment of attributes.
-
#_assigning? ⇒ true | false
readonly
private
Is the current thread in assigning mode?
-
#_binding ⇒ Object
readonly
private
Execute a block in binding mode.
-
#_binding? ⇒ true | false
readonly
private
Is the current thread in binding mode?
-
#_building ⇒ Object
readonly
private
Execute a block in building mode.
-
#_building? ⇒ true | false
readonly
private
Is the current thread in building mode?
-
#_creating? ⇒ true | false
readonly
private
Is the current thread in creating mode?
-
#_loading ⇒ Object
readonly
private
Execute a block in loading mode.
-
#_loading? ⇒ true | false
readonly
private
Is the current thread in loading mode?
Instance Attribute Details
#_assigning ⇒ Object
(readonly, private)
Begin the assignment of attributes. While in this block embedded documents will not autosave themselves in order to allow the document to be in a valid state.
# File 'lib/mongoid/threaded/lifecycle.rb', line 29
def _assigning Threaded.begin_execution(ASSIGN) yield ensure Threaded.exit_execution(ASSIGN) end
#_assigning? ⇒ true
| false
(readonly, private)
Is the current thread in assigning mode?
# File 'lib/mongoid/threaded/lifecycle.rb', line 42
def _assigning? Threaded.executing?(ASSIGN) end
#_binding ⇒ Object
(readonly, private)
Execute a block in binding mode.
# File 'lib/mongoid/threaded/lifecycle.rb', line 54
def _binding Threaded.begin_execution(BIND) yield ensure Threaded.exit_execution(BIND) end
#_binding? ⇒ true
| false
(readonly, private)
Is the current thread in binding mode?
# File 'lib/mongoid/threaded/lifecycle.rb', line 67
def _binding? Threaded.executing?(BIND) end
#_building ⇒ Object
(readonly, private)
Execute a block in building mode.
# File 'lib/mongoid/threaded/lifecycle.rb', line 79
def _building Threaded.begin_execution(BUILD) yield ensure Threaded.exit_execution(BUILD) end
#_building? ⇒ true
| false
(readonly, private)
Is the current thread in building mode?
# File 'lib/mongoid/threaded/lifecycle.rb', line 92
def _building? Threaded.executing?(BUILD) end
#_creating? ⇒ true
| false
(readonly, private)
Is the current thread in creating mode?
# File 'lib/mongoid/threaded/lifecycle.rb', line 102
def _creating? Threaded.executing?(CREATE) end
#_loading ⇒ Object
(readonly, private)
Execute a block in loading mode.
# File 'lib/mongoid/threaded/lifecycle.rb', line 114
def _loading Threaded.begin_execution(LOAD) yield ensure Threaded.exit_execution(LOAD) end
#_loading? ⇒ true
| false
(readonly, private)
Is the current thread in loading mode?
# File 'lib/mongoid/threaded/lifecycle.rb', line 127
def _loading? Threaded.executing?(LOAD) end