Module: Neo4j::Wrapper::RelationshipMixin::Initialize

Included in:
RelationshipMixin
Defined in:
lib/neo4j-wrapper/relationship_mixin/initialize.rb

Instance Method Summary collapse

Instance Method Details

#_java_relObject Also known as: _java_entity



25
26
27
# File 'lib/neo4j-wrapper/relationship_mixin/initialize.rb', line 25

def _java_rel
  @_java_rel
end

#init_on_create(rel_type, from_node, to_node, *props) ⇒ Object

Creates a new node and initialize with given properties. You can override this to provide your own initialization.

Parameters:

  • type (String, Symbol)

    the type of the relationships

  • from_node (Neo4j::Node, Neo4j::NodeMixin)

    create relationship from this node

  • to_node (Neo4j::Node, Neo4j::NodeMixin)

    create relationship to this node

  • props (Hash)

    optional hash of properties to initialize the create relationship with



16
17
18
19
20
21
# File 'lib/neo4j-wrapper/relationship_mixin/initialize.rb', line 16

def init_on_create(rel_type, from_node, to_node, *props) # :nodoc:
  _java_entity[:_classname] = self.class.to_s
  if props.first.respond_to?(:each_pair)
    props.first.each_pair { |k, v| respond_to?("#{k}=") ? self.send("#{k}=", v) : @_java_rel[k] = v }
  end
end

#init_on_load(java_rel) ⇒ Object

Init this node with the specified java neo4j relationship.



7
8
9
# File 'lib/neo4j-wrapper/relationship_mixin/initialize.rb', line 7

def init_on_load(java_rel)
  @_java_rel = java_rel
end