Class: Mementus::NodeProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/mementus/node_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(id, graph) ⇒ NodeProxy

Returns a new instance of NodeProxy.



3
4
5
6
# File 'lib/mementus/node_proxy.rb', line 3

def initialize(id, graph)
  @id = id
  @graph = graph
end

Instance Method Details

#adjacentObject



20
21
22
23
24
# File 'lib/mementus/node_proxy.rb', line 20

def adjacent
  each_adjacent.to_a.map do |node|
    self.class.new(node, @graph)
  end
end

#each_adjacent(&block) ⇒ Object



16
17
18
# File 'lib/mementus/node_proxy.rb', line 16

def each_adjacent(&block)
  @graph.each_adjacent(@id, &block)
end

#idObject



8
9
10
# File 'lib/mementus/node_proxy.rb', line 8

def id
  @id
end

#labelObject



12
13
14
# File 'lib/mementus/node_proxy.rb', line 12

def label
  @node.label
end