Class: Wewoo::Vertex

Inherits:
Element show all
Includes:
Adapter
Defined in:
lib/wewoo/vertex.rb

Overview

BOZO !! Need to support chaining!

Instance Attribute Summary

Attributes inherited from Element

#graph, #id, #properties

Instance Method Summary collapse

Methods included from Adapter

delete, get, handle_response, log, logger, post, put

Methods inherited from Element

#gid

Instance Method Details

#<=>(o) ⇒ Object



19
# File 'lib/wewoo/vertex.rb', line 19

def <=>(o); self.class == o.class ? self.id <=> o.id : super; end

#==(o) ⇒ Object Also known as: eql?



14
15
16
# File 'lib/wewoo/vertex.rb', line 14

def ==( o )
  self.class == o.class and self.id == o.id and self.props == o.props
end

#both(*labels) ⇒ Object



12
# File 'lib/wewoo/vertex.rb', line 12

def both( *labels ); @both || get_vertices( :both, labels ); end

#bothE(*labels) ⇒ Object



8
# File 'lib/wewoo/vertex.rb', line 8

def bothE( *labels ); @bothE || get_edges( :bothE, labels ); end

#destroyObject



21
22
23
# File 'lib/wewoo/vertex.rb', line 21

def destroy
  graph.remove_vertex( id )
end

#dumpObject



30
31
32
# File 'lib/wewoo/vertex.rb', line 30

def dump
  props.clone().merge( id: id )
end

#hashObject



18
# File 'lib/wewoo/vertex.rb', line 18

def hash; id; end

#in(*labels) ⇒ Object



11
# File 'lib/wewoo/vertex.rb', line 11

def in  ( *labels ); @in   || get_vertices( :in  , labels ); end

#inE(*labels) ⇒ Object



7
# File 'lib/wewoo/vertex.rb', line 7

def inE  ( *labels ); @inE   || get_edges( :inE  , labels ); end

#out(*labels) ⇒ Object



10
# File 'lib/wewoo/vertex.rb', line 10

def out ( *labels ); @out  || get_vertices( :out , labels ); end

#outE(*labels) ⇒ Object



6
# File 'lib/wewoo/vertex.rb', line 6

def outE ( *labels ); @outE  || get_edges( :outE , labels ); end

#to_sObject Also known as: inspect



25
26
27
# File 'lib/wewoo/vertex.rb', line 25

def to_s
 "v(#{self.id})"
end