Class: Y2Network::AutoinstProfile::AliasSection
- Inherits:
-
Installation::AutoinstProfile::SectionWithAttributes
- Object
- Installation::AutoinstProfile::SectionWithAttributes
- Y2Network::AutoinstProfile::AliasSection
- Defined in:
- src/lib/y2network/autoinst_profile/alias_section.rb
Overview
This class represents an alias specification within the
It is case insensitive.
Instance Attribute Summary collapse
-
#ipaddr ⇒ String
IP address.
-
#label ⇒ String
Alias label.
-
#netmask ⇒ String
IP netmask.
-
#prefixlen ⇒ String
Prefix length.
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_network(config) ⇒ AliasSection
Clones an IP config into an AutoYaST alias section.
Instance Method Summary collapse
-
#init_from_config(config) ⇒ Boolean
Method used by AliasSection.new_from_network to populate the attributes when cloning an IP config.
-
#init_from_hashes(config) ⇒ Boolean
Method used by new_from_hashes to populate the attributes using a hash.
Instance Attribute Details
#ipaddr ⇒ String
Returns IP address.
|
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 49
|
#label ⇒ String
Returns alias label.
|
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 52
|
#netmask ⇒ String
Returns IP netmask.
|
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 55
|
#prefixlen ⇒ String
Returns prefix length.
|
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 55
|
Class Method Details
.attributes ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 38 def self.attributes [ { name: :ipaddr }, { name: :label }, { name: :prefixlen }, { name: :netmask } ] end |
.new_from_network(config) ⇒ AliasSection
Clones an IP config into an AutoYaST alias section
65 66 67 68 69 |
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 65 def self.new_from_network(config) result = new result.init_from_config(config) result end |
Instance Method Details
#init_from_config(config) ⇒ Boolean
Method used by new_from_network to populate the attributes when cloning an IP config
75 76 77 78 79 |
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 75 def init_from_config(config) @ipaddr = config.address&.address&.to_s @label = config.label @prefixlen = config.address&.prefix&.to_s end |
#init_from_hashes(config) ⇒ Boolean
Method used by new_from_hashes to populate the attributes using a hash
85 86 87 88 |
# File 'src/lib/y2network/autoinst_profile/alias_section.rb', line 85 def init_from_hashes(config) normalized_config = config.each_with_object({}) { |(k, v), c| c[k.downcase] = v } super(normalized_config) end |