Class: Doodl::Edge
- Inherits:
-
Object
- Object
- Doodl::Edge
- Defined in:
- lib/edge.rb
Direct Known Subclasses
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
-
#initialize(source, target) ⇒ Edge
constructor
A new instance of Edge.
- #reflexive? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(source, target) ⇒ Edge
Returns a new instance of Edge.
8 9 10 11 |
# File 'lib/edge.rb', line 8 def initialize(source, target) @source = source @target = target end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/edge.rb', line 6 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/edge.rb', line 6 def target @target end |
Instance Method Details
#reflexive? ⇒ Boolean
17 18 19 |
# File 'lib/edge.rb', line 17 def reflexive? @source == @target end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/edge.rb', line 13 def to_s "(#{@source}, #{@target})" end |