Class: ObjectGraph::Node

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/ograph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node_id, name) ⇒ Node

Returns a new instance of Node.



435
436
437
438
439
440
441
442
# File 'lib/ograph.rb', line 435

def initialize(node_id, name)
  @node_id  = node_id
  @name     = name
  @values   = []
  @pointers = Hash.new { |h,k| h[k] = [] }
  @options  = {}
  @lost_links = []
end

Instance Attribute Details

Returns the value of attribute lost_links.



433
434
435
# File 'lib/ograph.rb', line 433

def lost_links
  @lost_links
end

#nameObject

Returns the value of attribute name.



433
434
435
# File 'lib/ograph.rb', line 433

def name
  @name
end

#node_idObject

Returns the value of attribute node_id.



433
434
435
# File 'lib/ograph.rb', line 433

def node_id
  @node_id
end

#optionsObject

Returns the value of attribute options.



433
434
435
# File 'lib/ograph.rb', line 433

def options
  @options
end

#pointersObject

Returns the value of attribute pointers.



433
434
435
# File 'lib/ograph.rb', line 433

def pointers
  @pointers
end

#valuesObject

Returns the value of attribute values.



433
434
435
# File 'lib/ograph.rb', line 433

def values
  @values
end

Instance Method Details

#<=>(other) ⇒ Object



444
445
446
# File 'lib/ograph.rb', line 444

def <=>(other)
  self.node_id <=> other.node_id
end