Class: Path

Inherits:
Object
  • Object
show all
Defined in:
lib/network_entities/abstracts/path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#destinationObject (readonly)

Returns the value of attribute destination.



2
3
4
# File 'lib/network_entities/abstracts/path.rb', line 2

def destination
  @destination
end

Returns the value of attribute links.



2
3
4
# File 'lib/network_entities/abstracts/path.rb', line 2

def links
  @links
end

#sourceObject (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



13
14
15
# File 'lib/network_entities/abstracts/path.rb', line 13

def add_link(link)
	@links.push link
end