Class: Mementus::EdgeBuilder
- Inherits:
-
Object
- Object
- Mementus::EdgeBuilder
- Defined in:
- lib/mementus/edge_builder.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#label ⇒ Object
Returns the value of attribute label.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #id=(id) ⇒ Object
-
#initialize(from = nil, to = nil, label = :edge) ⇒ EdgeBuilder
constructor
A new instance of EdgeBuilder.
- #nodes ⇒ Object
- #other(node) ⇒ Object
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
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/mementus/edge_builder.rb', line 3 def from @from end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/mementus/edge_builder.rb', line 3 def label @label end |
#to ⇒ Object
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 |
#nodes ⇒ Object
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 |