Module: ActiveGraph::Shared::Callbacks
- Extended by:
- ActiveSupport::Concern
- Included in:
- Node::Callbacks, Relationship::Callbacks
- Defined in:
- lib/active_graph/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.
40 41 42 43 |
# File 'lib/active_graph/shared/callbacks.rb', line 40 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 |
# File 'lib/active_graph/shared/callbacks.rb', line 22 def destroy #:nodoc: ActiveGraph::Base.validating_transaction do |tx| tx.after_commit { run_callbacks(:destroy_commit) {} } run_callbacks(:destroy) { super } end rescue @_deleted = false @attributes = @attributes.dup raise end |
#initialize(args = nil) ⇒ Object
18 19 20 |
# File 'lib/active_graph/shared/callbacks.rb', line 18 def initialize(args = nil) run_callbacks(:initialize) { super } end |
#touch ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/active_graph/shared/callbacks.rb', line 33 def touch #:nodoc: run_callbacks(:touch) { super } end |