Class: Switch::Peer

Inherits:
Object
  • Object
show all
Defined in:
lib/netutils/switch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sw, portname) ⇒ Peer

Returns a new instance of Peer.



44
45
46
47
# File 'lib/netutils/switch.rb', line 44

def initialize(sw, portname)
	@sw = sw
	@port = portname
end

Instance Attribute Details

#portObject (readonly)

Returns the value of attribute port.



42
43
44
# File 'lib/netutils/switch.rb', line 42

def port
  @port
end

#swObject (readonly)

Returns the value of attribute sw.



42
43
44
# File 'lib/netutils/switch.rb', line 42

def sw
  @sw
end

Instance Method Details

#_to_ascii(sep) ⇒ Object



53
54
55
# File 'lib/netutils/switch.rb', line 53

def _to_ascii(sep)
	return "#{@sw.name}#{sep}#{@port}"
end

#has_backlink?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/netutils/switch.rb', line 49

def has_backlink?
	return @sw.ports.exists?(@port)
end

#to_csvObject



61
62
63
# File 'lib/netutils/switch.rb', line 61

def to_csv
	_to_ascii(',')
end

#to_sObject



57
58
59
# File 'lib/netutils/switch.rb', line 57

def to_s
	_to_ascii(' ')
end