Class: Cadet::Node

Inherits:
PropertyContainer show all
Defined in:
lib/cadet/node.rb

Direct Known Subclasses

BatchInserter::Node

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PropertyContainer

#[], #[]=

Constructor Details

#initialize(node, db = nil) ⇒ Node

Returns a new instance of Node.



6
7
8
9
# File 'lib/cadet/node.rb', line 6

def initialize(node, db = nil)
  @db = db
  @underlying = node
end

Instance Attribute Details

#underlying ⇒ Object

Returns the value of attribute underlying.



3
4
5
# File 'lib/cadet/node.rb', line 3

def underlying
  @underlying
end

Instance Method Details

#add_label(label) ⇒ Object



11
12
13
14
# File 'lib/cadet/node.rb', line 11

def add_label(label)
  @underlying.addLabel(DynamicLabel.label(label))
  self
end

#create_outgoing(to, type) ⇒ Object



26
27
28
# File 'lib/cadet/node.rb', line 26

def create_outgoing(to, type)
  @underlying.createRelationshipTo(to.underlying, DynamicRelationshipType.withName(type))
end

#get_property(property) ⇒ Object



19
20
21
# File 'lib/cadet/node.rb', line 19

def get_property(property)
  @underlying.getProperty(property)
end

#get_relationships(direction, type) ⇒ Object



23
24
25
# File 'lib/cadet/node.rb', line 23

def get_relationships(direction, type)
  @underlying.getRelationships(direction, type)
end

#incoming(type) ⇒ Object



32
33
34
# File 'lib/cadet/node.rb', line 32

def incoming(type)
  Cadet::RelationshipTraverser.new(self, Direction::INCOMING, type)
end

#outgoing(type) ⇒ Object



29
30
31
# File 'lib/cadet/node.rb', line 29

def outgoing(type)
  Cadet::RelationshipTraverser.new(self, Direction::OUTGOING, type)
end

#set_property(property, value) ⇒ Object



16
17
18
# File 'lib/cadet/node.rb', line 16

def set_property(property, value)
  @underlying.setProperty(property, value)
end