Class: Mementus::NodeProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(node, graph) ⇒ NodeProxy

Returns a new instance of NodeProxy.



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

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

Instance Method Details

#[](prop) ⇒ Object



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

def [](prop)
  @node[prop]
end

#adjacentObject



32
33
34
# File 'lib/mementus/node_proxy.rb', line 32

def adjacent
  @graph.adjacent(@node.id)
end

#adjacent_edgesObject



36
37
38
# File 'lib/mementus/node_proxy.rb', line 36

def adjacent_edges
  @graph.adjacent_edges(@node.id)
end

#each_adjacent(&block) ⇒ Object



28
29
30
# File 'lib/mementus/node_proxy.rb', line 28

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

#idObject



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

def id
  @node.id
end

#labelObject



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

def label
  @node.label
end

#out_eObject



24
25
26
# File 'lib/mementus/node_proxy.rb', line 24

def out_e
  Pipeline::Step.new(adjacent_edges, Pipeline::Pipe.new(@graph), @graph)
end

#propsObject



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

def props
  @node.props
end