Class: Mementus::EdgeBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from = nil, to = nil, label = :edge) ⇒ EdgeBuilder

Returns a new instance of EdgeBuilder.



5
6
7
8
9
10
# File 'lib/mementus/edge_builder.rb', line 5

def initialize(from=nil, to=nil, label=:edge)
  @from = from
  @to = to
  @label = label
  @id = nil
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



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

def from
  @from
end

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#toObject

Returns the value of attribute to.



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

def to
  @to
end

Instance Method Details

#id=(id) ⇒ Object



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

def id=(id)
  @id = id
end

#nodesObject



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

def nodes
  [@from, @to]
end

#other(node) ⇒ Object



40
41
42
# File 'lib/mementus/edge_builder.rb', line 40

def other(node)
  @from == node ? @to : @from
end