Sha256: b928bb3e3800e06329dbc9b0e7d1527776774ca14db2c0dfc66919fa4111c17f

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

module Neo4j::ActiveRel
  module Initialize
    extend ActiveSupport::Concern
    include Neo4j::Shared::TypeConverters

    attr_reader :_persisted_obj

    # called when loading the rel from the database
    # @param [Hash] properties properties of this relationship
    # @param [Neo4j::Relationship] start_node the starting node in the relationship.
    # @param [Neo4j::Relationship] end_node the ending node in the relationship
    # @param [String] type the relationship type
    def init_on_load(persisted_rel, from_node_id, to_node_id, type)
      @_persisted_obj = persisted_rel
      @rel_type = type
      changed_attributes && changed_attributes.clear
      @attributes = attributes.merge(persisted_rel.props.stringify_keys)
      load_nodes(from_node_id, to_node_id)
      self.default_properties = persisted_rel.props
      @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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neo4j-4.1.5 lib/neo4j/active_rel/initialize.rb
neo4j-4.1.4 lib/neo4j/active_rel/initialize.rb
neo4j-4.1.3 lib/neo4j/active_rel/initialize.rb
neo4j-4.1.2 lib/neo4j/active_rel/initialize.rb
neo4j-4.1.1 lib/neo4j/active_rel/initialize.rb
neo4j-4.1.0 lib/neo4j/active_rel/initialize.rb
neo4j-4.0.0 lib/neo4j/active_rel/initialize.rb
neo4j-4.0.0.rc.4 lib/neo4j/active_rel/initialize.rb
neo4j-4.0.0.rc.3 lib/neo4j/active_rel/initialize.rb
neo4j-4.0.0.rc.1 lib/neo4j/active_rel/initialize.rb