Class: GraphAgent::Graph::Edge
- Inherits:
-
Object
- Object
- GraphAgent::Graph::Edge
- Defined in:
- lib/graph_agent/graph/edge.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(source, target) ⇒ Edge
constructor
A new instance of Edge.
Constructor Details
#initialize(source, target) ⇒ Edge
Returns a new instance of Edge.
8 9 10 11 |
# File 'lib/graph_agent/graph/edge.rb', line 8 def initialize(source, target) @source = source.to_s @target = target.to_s end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/graph_agent/graph/edge.rb', line 6 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/graph_agent/graph/edge.rb', line 6 def target @target end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
13 14 15 |
# File 'lib/graph_agent/graph/edge.rb', line 13 def ==(other) other.is_a?(Edge) && source == other.source && target == other.target end |
#hash ⇒ Object
18 19 20 |
# File 'lib/graph_agent/graph/edge.rb', line 18 def hash [source, target].hash end |