Class: Aspen::Edge
- Inherits:
-
Object
- Object
- Aspen::Edge
- Defined in:
- lib/aspen/edge.rb
Instance Method Summary collapse
-
#initialize(name, mutual: false) ⇒ Edge
constructor
A new instance of Edge.
- #label ⇒ Object
- #mutual? ⇒ Boolean (also: #reciprocal?)
- #signature ⇒ Object
- #to_cypher ⇒ Object
Constructor Details
#initialize(name, mutual: false) ⇒ Edge
TODO:
Rename :word to :label
Returns a new instance of Edge.
5 6 7 8 |
# File 'lib/aspen/edge.rb', line 5 def initialize(name, mutual: false) @name = name @mutual = mutual end |
Instance Method Details
#label ⇒ Object
10 11 12 |
# File 'lib/aspen/edge.rb', line 10 def label @name end |
#mutual? ⇒ Boolean Also known as: reciprocal?
22 23 24 |
# File 'lib/aspen/edge.rb', line 22 def mutual? @mutual end |
#signature ⇒ Object
18 19 20 |
# File 'lib/aspen/edge.rb', line 18 def signature to_cypher.gsub(/:/, '') end |
#to_cypher ⇒ Object
14 15 16 |
# File 'lib/aspen/edge.rb', line 14 def to_cypher "-[:#{label.parameterize.underscore.upcase}]-#{cap}" end |