Class: Ifconf::Parsers::LinkLayerLine
- Inherits:
-
Object
- Object
- Ifconf::Parsers::LinkLayerLine
- Defined in:
- lib/ifconf/parsers/link_layer_line.rb
Overview
Frozen value object wrapping the link layer data from an ifconfig block. Searches the block for an ether/loop line and txqueuelen. Exposes the raw encapsulation name, MAC string, and TX queue length.
Constant Summary collapse
- LINK_LINE_PATTERN =
%r{\A\s*(ether|loop|link/ether)\b}- ETHER_KEYWORD_PATTERN =
/\bether\b/- ENCAP_PATTERN =
/\(([^)]+)\)/- TXQUEUE_PATTERN =
/txqueuelen\s+(\d+)/
Instance Attribute Summary collapse
-
#encapsulation ⇒ Object
readonly
Returns the value of attribute encapsulation.
-
#mac ⇒ Object
readonly
Returns the value of attribute mac.
-
#tx_queue_len ⇒ Object
readonly
Returns the value of attribute tx_queue_len.
Instance Method Summary collapse
-
#initialize(block) ⇒ LinkLayerLine
constructor
A new instance of LinkLayerLine.
Constructor Details
#initialize(block) ⇒ LinkLayerLine
Returns a new instance of LinkLayerLine.
16 17 18 19 20 21 |
# File 'lib/ifconf/parsers/link_layer_line.rb', line 16 def initialize(block) link_line = block.find_line(LINK_LINE_PATTERN) @tx_queue_len = extract_txqueuelen(block) extract_link_fields(link_line) freeze end |
Instance Attribute Details
#encapsulation ⇒ Object (readonly)
Returns the value of attribute encapsulation.
14 15 16 |
# File 'lib/ifconf/parsers/link_layer_line.rb', line 14 def encapsulation @encapsulation end |
#mac ⇒ Object (readonly)
Returns the value of attribute mac.
14 15 16 |
# File 'lib/ifconf/parsers/link_layer_line.rb', line 14 def mac @mac end |
#tx_queue_len ⇒ Object (readonly)
Returns the value of attribute tx_queue_len.
14 15 16 |
# File 'lib/ifconf/parsers/link_layer_line.rb', line 14 def tx_queue_len @tx_queue_len end |