Class: Iface::ValueSet::IpV6Primary
- Defined in:
- lib/iface/value_set/pair.rb
Overview
Represents a pair for IPV6ADDR, which is output in the form IPV6ADDR=“ipv6-address/prefix-length”
Instance Attribute Summary
Attributes inherited from Pair
Instance Method Summary collapse
-
#initialize(_name, value, value_set) ⇒ IpV6Primary
constructor
A new instance of IpV6Primary.
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Methods inherited from Pair
Constructor Details
#initialize(_name, value, value_set) ⇒ IpV6Primary
Returns a new instance of IpV6Primary.
63 64 65 66 |
# File 'lib/iface/value_set/pair.rb', line 63 def initialize(_name, value, value_set) super('IPV6ADDR', value, value_set) self.value = value end |
Instance Method Details
#value ⇒ Object
68 69 70 |
# File 'lib/iface/value_set/pair.rb', line 68 def value "#{IpV6Address.from_numeric(@value)}/#{@mask}" end |
#value=(new_value) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/iface/value_set/pair.rb', line 72 def value=(new_value) ip, mask = new_value.split(%r{/}) ipaddr = IpV6Address.new(ip) @value = ipaddr.to_i @mask = mask || 64 @value_set['ipv6_secondaries']&.filter_primary!(@value) self end |