Module: ActiveCypher::Model::ConnectionOwner

Extended by:
ActiveSupport::Concern
Includes:
Logging, ConnectionHandling
Included in:
Base, Relationship
Defined in:
lib/active_cypher/model/connection_owner.rb

Overview

Mixin for anything that “owns” a connection (nodes, relationships, maybe graph‑level service objects later). 100 % framework‑agnostic.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#log_bench, #log_debug, #log_error, #log_info, #log_warn, #logger, logger

Class Method Details

.db_key_for(mapping, role) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/active_cypher/model/connection_owner.rb', line 12

def self.db_key_for(mapping, role)
  return nil unless mapping.is_a?(Hash)

  value = mapping[role]
  value = mapping[:writing] if value.nil?

  resolve_db_value(value, mapping[:writing])
end

Instance Method Details

#adapter_classObject

Instance method to access the adapter class



109
110
111
# File 'lib/active_cypher/model/connection_owner.rb', line 109

def adapter_class
  self.class.adapter_class
end

#connectionObject

Instance method to access the connection dynamically



114
115
116
# File 'lib/active_cypher/model/connection_owner.rb', line 114

def connection
  self.class.connection
end