Class: Ifconf::Parsers::Ipv6Line
- Inherits:
-
Object
- Object
- Ifconf::Parsers::Ipv6Line
- Defined in:
- lib/ifconf/parsers/ipv6_line.rb
Overview
Frozen value object wrapping a single inet6 line from an ifconfig block. Extracts the IPv6 address (zone ID stripped), prefix length, and scope_id.
Constant Summary collapse
- INET6_PATTERN =
/\binet6\b/- INET6_ADDRESS_PATTERN =
/\binet6\s+(\S+)/- SCOPE_PATTERN =
/scopeid\s+0x[0-9a-f]+<(\w+)>/i- PREFIXLEN_PATTERN =
/\bprefixlen\s+(\d+)/- KNOWN_SCOPES =
Set[:link, :global, :host].freeze
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#prefix_length ⇒ Object
readonly
Returns the value of attribute prefix_length.
-
#scope_id ⇒ Object
readonly
Returns the value of attribute scope_id.
Instance Method Summary collapse
-
#initialize(line) ⇒ Ipv6Line
constructor
A new instance of Ipv6Line.
Constructor Details
#initialize(line) ⇒ Ipv6Line
Returns a new instance of Ipv6Line.
14 15 16 17 18 19 |
# File 'lib/ifconf/parsers/ipv6_line.rb', line 14 def initialize(line) @address = extract_address(line) @prefix_length = extract_prefix_length(line) @scope_id = extract_scope_id(line) freeze end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
12 13 14 |
# File 'lib/ifconf/parsers/ipv6_line.rb', line 12 def address @address end |
#prefix_length ⇒ Object (readonly)
Returns the value of attribute prefix_length.
12 13 14 |
# File 'lib/ifconf/parsers/ipv6_line.rb', line 12 def prefix_length @prefix_length end |
#scope_id ⇒ Object (readonly)
Returns the value of attribute scope_id.
12 13 14 |
# File 'lib/ifconf/parsers/ipv6_line.rb', line 12 def scope_id @scope_id end |