Module: Neo4j::ActiveNode::Unpersisted
- Included in:
- Neo4j::ActiveNode
- Defined in:
- lib/neo4j/active_node/unpersisted.rb
Instance Method Summary collapse
- #clear_deferred_nodes_for_association(association_name) ⇒ Object
- #defer_create(association_name, object, options = {}) ⇒ Object
-
#deferred_create_cache ⇒ Object
The values in this Hash are returned and used outside by reference so any modifications to the Array should be in-place.
- #deferred_nodes_for_association(association_name) ⇒ Object
- #pending_deferred_creations? ⇒ Boolean
Instance Method Details
#clear_deferred_nodes_for_association(association_name) ⇒ Object
24 25 26 |
# File 'lib/neo4j/active_node/unpersisted.rb', line 24 def clear_deferred_nodes_for_association(association_name) deferred_nodes_for_association(association_name.to_sym).clear end |
#defer_create(association_name, object, options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/neo4j/active_node/unpersisted.rb', line 10 def defer_create(association_name, object, = {}) clear_deferred_nodes_for_association(association_name) if [:clear] deferred_nodes_for_association(association_name) << object end |
#deferred_create_cache ⇒ Object
The values in this Hash are returned and used outside by reference so any modifications to the Array should be in-place
6 7 8 |
# File 'lib/neo4j/active_node/unpersisted.rb', line 6 def deferred_create_cache @deferred_create_cache ||= {} end |
#deferred_nodes_for_association(association_name) ⇒ Object
16 17 18 |
# File 'lib/neo4j/active_node/unpersisted.rb', line 16 def deferred_nodes_for_association(association_name) deferred_create_cache[association_name.to_sym] ||= [] end |
#pending_deferred_creations? ⇒ Boolean
20 21 22 |
# File 'lib/neo4j/active_node/unpersisted.rb', line 20 def pending_deferred_creations? !deferred_create_cache.values.all?(&:empty?) end |