Class: Ifconf::Parsers::HeaderLine
- Inherits:
-
Object
- Object
- Ifconf::Parsers::HeaderLine
- Defined in:
- lib/ifconf/parsers/header_line.rb
Overview
Frozen value object wrapping the first line of an ifconfig block. Extracts the interface name, flags bitmask, flag names, and MTU.
Constant Summary collapse
- FLAGS_PATTERN =
/flags=(\d+)<([^>]*)>/- MTU_PATTERN =
/\bmtu\s+(\d+)/- NAME_PATTERN =
/\A(.+?):\s*flags=/
Instance Attribute Summary collapse
-
#flag_names ⇒ Object
readonly
Returns the value of attribute flag_names.
-
#flags_int ⇒ Object
readonly
Returns the value of attribute flags_int.
-
#mtu ⇒ Object
readonly
Returns the value of attribute mtu.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(line) ⇒ HeaderLine
constructor
A new instance of HeaderLine.
Constructor Details
#initialize(line) ⇒ HeaderLine
Returns a new instance of HeaderLine.
12 13 14 15 16 17 18 |
# File 'lib/ifconf/parsers/header_line.rb', line 12 def initialize(line) @name = extract_name(line) @flags_int = extract_flags_int(line) @flag_names = extract_flag_names(line) @mtu = extract_mtu(line) freeze end |
Instance Attribute Details
#flag_names ⇒ Object (readonly)
Returns the value of attribute flag_names.
10 11 12 |
# File 'lib/ifconf/parsers/header_line.rb', line 10 def flag_names @flag_names end |
#flags_int ⇒ Object (readonly)
Returns the value of attribute flags_int.
10 11 12 |
# File 'lib/ifconf/parsers/header_line.rb', line 10 def flags_int @flags_int end |
#mtu ⇒ Object (readonly)
Returns the value of attribute mtu.
10 11 12 |
# File 'lib/ifconf/parsers/header_line.rb', line 10 def mtu @mtu end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/ifconf/parsers/header_line.rb', line 10 def name @name end |