Module: Neo4j::Shared::Callbacks
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveNode::Callbacks, ActiveRel::Callbacks
- Defined in:
- lib/neo4j/shared/callbacks.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#conditional_callback(kind, guard) ⇒ Object
Allows you to perform a callback if a condition is not satisfied.
-
#destroy ⇒ Object
:nodoc:.
- #initialize(args = nil) ⇒ Object
-
#touch ⇒ Object
:nodoc:.
Instance Method Details
#conditional_callback(kind, guard) ⇒ Object
Allows you to perform a callback if a condition is not satisfied.
42 43 44 45 |
# File 'lib/neo4j/shared/callbacks.rb', line 42 def conditional_callback(kind, guard) return yield if guard run_callbacks(kind) { yield } end |
#destroy ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/neo4j/shared/callbacks.rb', line 22 def destroy #:nodoc: tx = Neo4j::ActiveBase.new_transaction tx.root.after_commit { run_callbacks(:destroy_commit) {} } run_callbacks(:destroy) { super } rescue @_deleted = false @attributes = @attributes.dup tx.mark_failed if tx raise ensure tx.close if tx end |
#initialize(args = nil) ⇒ Object
18 19 20 |
# File 'lib/neo4j/shared/callbacks.rb', line 18 def initialize(args = nil) run_callbacks(:initialize) { super } end |
#touch ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/neo4j/shared/callbacks.rb', line 35 def touch #:nodoc: run_callbacks(:touch) { super } end |