Class: Mementus::NodeProxy
- Inherits:
-
Object
- Object
- Mementus::NodeProxy
- Defined in:
- lib/mementus/node_proxy.rb
Instance Method Summary collapse
- #adjacent ⇒ Object
- #each_adjacent(&block) ⇒ Object
- #id ⇒ Object
-
#initialize(id, graph) ⇒ NodeProxy
constructor
A new instance of NodeProxy.
- #label ⇒ Object
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
#adjacent ⇒ Object
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 |
#id ⇒ Object
8 9 10 |
# File 'lib/mementus/node_proxy.rb', line 8 def id @id end |
#label ⇒ Object
12 13 14 |
# File 'lib/mementus/node_proxy.rb', line 12 def label @node.label end |