Method: Neo4j::Wrapper::NodeMixin::ClassMethods#load_entity

Defined in:
lib/neo4j-wrapper/node_mixin/class_methods.rb

#load_entity(neo_id) ⇒ Object?

Note:

it will return nil if the node returned is not kind of this class

Loads a wrapped node from the database given a neo id.

Parameters:

  • neo_id (#to_i, nil)

Returns:

  • (Object, nil)

    If the node does not exist it will return nil otherwise the loaded node or wrapped node.



87
88
89
90
91
92
# File 'lib/neo4j-wrapper/node_mixin/class_methods.rb', line 87

def load_entity(neo_id)
  node = Neo4j::Node.load(neo_id)
  return nil if node.nil?
  return node if node.class == Neo4j::Node
  node.kind_of?(self) ? node : nil
end