Class: Aspen::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/aspen/edge.rb

Instance Method Summary collapse

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

#labelObject



10
11
12
# File 'lib/aspen/edge.rb', line 10

def label
  @name
end

#mutual?Boolean Also known as: reciprocal?

Returns:

  • (Boolean)


22
23
24
# File 'lib/aspen/edge.rb', line 22

def mutual?
  @mutual
end

#signatureObject



18
19
20
# File 'lib/aspen/edge.rb', line 18

def signature
  to_cypher.gsub(/:/, '')
end

#to_cypherObject



14
15
16
# File 'lib/aspen/edge.rb', line 14

def to_cypher
  "-[:#{label.parameterize.underscore.upcase}]-#{cap}"
end