Class: Neography::Node
Constant Summary
Neography::NodeRelationship::DIRECTIONS
Instance Attribute Summary collapse
#neo_id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Property
#[], #[]=, #add_or_remove_ostruct_member, #attributes, #method_missing, #new_ostruct_member, #node?, #remove_ostruct_member, #reset_properties, #set_properties
Methods included from Equal
#==, #eql?
Methods included from NodePath
#all_paths_to, #all_shortest_paths_to, #all_simple_paths_to, #path_to, #shortest_path_to, #simple_path_to
#both, #incoming, #outgoing, #rel, #rel?, #rels
Methods included from Index
#add_to_index, included, #remove_from_index
#initialize
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
11
12
13
14
15
16
17
|
# File 'lib/neography/node.rb', line 11
def self.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
|
.create_unique(index, key, value, props = nil, db = Neography::Rest.new) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/neography/node.rb', line 19
def self.create_unique(index, key, value, props = nil, db = Neography::Rest.new)
raise ArgumentError.new("syntax deprecated") if props.is_a?(Neography::Rest)
node = self.new(db.create_unique_node(index, key, value, props))
node.neo_server = db
node
end
|
.load(node, db = Neography::Rest.new) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/neography/node.rb', line 27
def self.load(node, db = Neography::Rest.new)
raise ArgumentError.new("syntax deprecated") if node.is_a?(Neography::Rest)
node = node.first if node.kind_of?(Array)
node = db.get_node(node) if (node.to_s.match(/^\d+$/) or node.to_s.split("/").last.match(/^\d+$/))
if node
node = self.new(node)
node.neo_server = db
end
node
end
|
Instance Method Details
#add_labels(labels) ⇒ Object
Also known as:
add_label
69
70
71
72
73
|
# File 'lib/neography/node.rb', line 69
def add_labels(labels)
@cached_labels = nil
self.neo_server.add_label(self, [labels].flatten)
end
|
#cached_labels=(labels) ⇒ Object
82
83
84
|
# File 'lib/neography/node.rb', line 82
def cached_labels=(labels)
@cached_labels = [labels].flatten
end
|
#del ⇒ Object
43
44
45
|
# File 'lib/neography/node.rb', line 43
def del
neo_server.delete_node!(self.neo_id)
end
|
#delete_label(label) ⇒ Object
77
78
79
80
|
# File 'lib/neography/node.rb', line 77
def delete_label(label)
@cached_labels = nil
self.neo_server.delete_label(self, label)
end
|
#exist? ⇒ Boolean
47
48
49
50
51
52
53
54
|
# File 'lib/neography/node.rb', line 47
def exist?
begin
neo_server.get_node(self.neo_id)
true
rescue NodeNotFoundException
false
end
end
|
#find(*args) ⇒ Object
38
39
40
41
|
# File 'lib/neography/node.rb', line 38
def find(*args)
node = self.new
node.find(args)
end
|
#labels ⇒ Object
56
57
58
|
# File 'lib/neography/node.rb', line 56
def labels
@cached_labels ||= [self.neo_server.get_node_labels(self.neo_id)].compact.flatten
end
|
#set_labels(labels) ⇒ Object
Also known as:
set_label
60
61
62
63
64
65
66
|
# File 'lib/neography/node.rb', line 60
def set_labels(labels)
@cached_labels = nil
self.neo_server.set_label(self, [labels].flatten)
end
|