Class: Path
- Inherits:
-
Object
- Object
- Path
- Defined in:
- lib/network_entities/abstracts/path.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #add_link(link) ⇒ Object
-
#initialize(source, destination) ⇒ Path
constructor
A new instance of Path.
Constructor Details
#initialize(source, destination) ⇒ Path
Returns a new instance of Path.
4 5 6 7 8 9 10 11 |
# File 'lib/network_entities/abstracts/path.rb', line 4 def initialize(source, destination) raise "Invalid 'source' argument received. Path must contain a source" unless source raise "Invalid 'destination' argument received. Path must contain a destination" unless destination @source = source @destination = destination @links = [] end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
2 3 4 |
# File 'lib/network_entities/abstracts/path.rb', line 2 def destination @destination end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
2 3 4 |
# File 'lib/network_entities/abstracts/path.rb', line 2 def links @links end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
2 3 4 |
# File 'lib/network_entities/abstracts/path.rb', line 2 def source @source end |
Instance Method Details
#add_link(link) ⇒ Object
13 14 15 |
# File 'lib/network_entities/abstracts/path.rb', line 13 def add_link(link) @links.push link end |