Module: Neography::NodeRelationship

Included in:
Node
Defined in:
lib/neography/node_relationship.rb

Constant Summary collapse

DIRECTIONS =
["incoming", "in", "outgoing", "out", "all", "both"]

Instance Method Summary collapse

Instance Method Details

#both(types = nil) ⇒ Object


14
15
16
# File 'lib/neography/node_relationship.rb', line 14

def both(types=nil)
  NodeTraverser.new(self).both(types)
end

#incoming(types = nil) ⇒ Object


10
11
12
# File 'lib/neography/node_relationship.rb', line 10

def incoming(types=nil)
  NodeTraverser.new(self).incoming(types)
end

#outgoing(types = nil) ⇒ Object


6
7
8
# File 'lib/neography/node_relationship.rb', line 6

def outgoing(types=nil)
  NodeTraverser.new(self).outgoing(types)
end

#rel(dir, type) ⇒ Object


22
23
24
25
26
# File 'lib/neography/node_relationship.rb', line 22

def rel(dir, type)
  rel = Neography::RelationshipTraverser.new(self, type, dir)
  rel = rel.first unless rel.empty?
  rel
end

#rel?(dir = nil, type = nil) ⇒ Boolean


28
29
30
31
32
33
34
# File 'lib/neography/node_relationship.rb', line 28

def rel?(dir=nil, type=nil)
  if DIRECTIONS.include?(dir.to_s)
    !self.neo_server.get_node_relationships(self, dir, type).empty? 
  else
    !self.neo_server.get_node_relationships(self, type, dir).empty? 
  end
end

#rels(*types) ⇒ Object


18
19
20
# File 'lib/neography/node_relationship.rb', line 18

def rels(*types)
  Neography::RelationshipTraverser.new(self, types, :both)
end