Sha256: c7c60fe14e38b40e673cdda47c5f3938f8d46c766a1734b8eb820af30e9da65a

Contents?: true

Size: 915 Bytes

Versions: 6

Compression:

Stored size: 915 Bytes

Contents

module Neo4j::ActiveNode::Initialize
  extend ActiveSupport::Concern
  include Neo4j::Shared::TypeConverters
  attr_reader :called_by

  # called when loading the node from the database
  # @param [Neo4j::Node] persisted_node the node this class wraps
  # @param [Hash] properties of the persisted node.
  def init_on_load(persisted_node, properties)
    @_association_attributes = self.class.extract_association_attributes!(properties)
    @_persisted_obj = persisted_node
    @association_cache = {}
    changed_attributes && changed_attributes.clear
    @attributes = attributes.merge(properties.stringify_keys)
    self.default_properties = properties
    @attributes = convert_properties_to :ruby, @attributes
  end

  # Implements the Neo4j::Node#wrapper and Neo4j::Relationship#wrapper method
  # so that we don't have to care if the node is wrapped or not.
  # @return self
  def wrapper
    self
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
neo4j-4.1.5 lib/neo4j/active_node/initialize.rb
neo4j-4.1.4 lib/neo4j/active_node/initialize.rb
neo4j-4.1.3 lib/neo4j/active_node/initialize.rb
neo4j-4.1.2 lib/neo4j/active_node/initialize.rb
neo4j-4.1.1 lib/neo4j/active_node/initialize.rb
neo4j-4.1.0 lib/neo4j/active_node/initialize.rb