Class: Switch::Peer
- Inherits:
-
Object
- Object
- Switch::Peer
- Defined in:
- lib/netutils/switch.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#sw ⇒ Object
readonly
Returns the value of attribute sw.
Instance Method Summary collapse
- #_to_ascii(sep) ⇒ Object
- #has_backlink? ⇒ Boolean
-
#initialize(sw, portname) ⇒ Peer
constructor
A new instance of Peer.
- #to_csv ⇒ Object
- #to_s ⇒ Object
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
#port ⇒ Object (readonly)
Returns the value of attribute port.
42 43 44 |
# File 'lib/netutils/switch.rb', line 42 def port @port end |
#sw ⇒ Object (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
49 50 51 |
# File 'lib/netutils/switch.rb', line 49 def has_backlink? return @sw.ports.exists?(@port) end |
#to_csv ⇒ Object
61 62 63 |
# File 'lib/netutils/switch.rb', line 61 def to_csv _to_ascii(',') end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/netutils/switch.rb', line 57 def to_s _to_ascii(' ') end |