class NoSE::QueryGraph::Edge

An edge between two {Node}s in a {Graph}

Attributes

from[R]
key[R]
to[R]

Public Class Methods

new(from, to, key) click to toggle source
# File lib/nose/query_graph.rb, line 37
def initialize(from, to, key)
  @from = from
  @to = to
  @key = key
end

Public Instance Methods

==(other) click to toggle source

Edges are equal if the canonical parameters used to construct them are the same

# File lib/nose/query_graph.rb, line 51
def ==(other)
  return false unless other.is_a? Edge
  canonical_params == other.canonical_params
end
Also aliased as: eql?
canonical_params() click to toggle source

Produce the parameters to initialize the canonical version of this edge (this accounts for different directionality of edges) @return [Array]

# File lib/nose/query_graph.rb, line 64
def canonical_params
  if @from.entity.name > @to.entity.name
    [@from.entity.name, @to.entity.name, @key.name]
  else
    [@to.entity.name, @from.entity.name, @key.reverse.name]
  end
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/nose/query_graph.rb, line 57
def hash
  canonical_params.hash
end
inspect() click to toggle source

:nocov:

# File lib/nose/query_graph.rb, line 44
def inspect
  @key.inspect
end