Class: Neography::Node
- Inherits:
-
PropertyContainer
- Object
- OpenStruct
- PropertyContainer
- Neography::Node
- Includes:
- Equal, Index, NodePath, NodeRelationship, Property
- Defined in:
- lib/neography/node.rb
Constant Summary
Constants included from NodeRelationship
Neography::NodeRelationship::DIRECTIONS
Instance Attribute Summary collapse
-
#neo_server ⇒ Object
Returns the value of attribute neo_server.
Attributes inherited from PropertyContainer
Class Method Summary collapse
- .create(props = nil, db = Neography::Rest.new) ⇒ Object
- .load(node, db = Neography::Rest.new) ⇒ Object
Instance Method Summary collapse
Methods included from Property
#[], #[]=, #attributes, #method_missing, #new_ostruct_member
Methods included from Equal
Methods included from NodePath
#all_paths_to, #all_shortest_paths_to, #all_simple_paths_to, #path_to, #shortest_path_to, #simple_path_to
Methods included from NodeRelationship
#both, #incoming, #outgoing, #rel, #rel?, #rels
Methods included from Index
#add_to_index, included, #remove_from_index
Methods inherited from PropertyContainer
Constructor Details
This class inherits a constructor from Neography::PropertyContainer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Neography::Property
Instance Attribute Details
#neo_server ⇒ Object
Returns the value of attribute neo_server.
9 10 11 |
# File 'lib/neography/node.rb', line 9 def neo_server @neo_server end |
Class Method Details
.create(props = nil, db = Neography::Rest.new) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/neography/node.rb', line 12 def create(props = nil, db = Neography::Rest.new) raise ArgumentError.new("syntax deprecated") if props.is_a?(Neography::Rest) node = self.new(db.create_node(props)) node.neo_server = db node end |
.load(node, db = Neography::Rest.new) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/neography/node.rb', line 20 def load(node, db = Neography::Rest.new) raise ArgumentError.new("syntax deprecated") if node.is_a?(Neography::Rest) node = db.get_node(node) if node node = self.new(node) node.neo_server = db end node end |
Instance Method Details
#del ⇒ Object
39 40 41 |
# File 'lib/neography/node.rb', line 39 def del neo_server.delete_node!(self.neo_id) end |
#exist? ⇒ Boolean
43 44 45 46 47 48 49 50 |
# File 'lib/neography/node.rb', line 43 def exist? begin neo_server.get_node(self.neo_id) true rescue NodeNotFoundException false end end |
#find(*args) ⇒ Object
34 35 36 37 |
# File 'lib/neography/node.rb', line 34 def find(*args) node = self.new node.find(args) end |