Class: Y2Network::AutoinstProfile::RouteSection
- Inherits:
-
SectionWithAttributes
- Object
- SectionWithAttributes
- Y2Network::AutoinstProfile::RouteSection
- Defined in:
- src/lib/y2network/autoinst_profile/route_section.rb
Overview
This class represents an AutoYaST <route> section under <routing>
<route>
<destination>192.168.1.0</destination>
<device>eth0</device>
<extrapara>foo</extrapara>
<gateway>-</gateway>
<netmask>-</netmask>
</route>
Instance Attribute Summary collapse
-
#destination ⇒ String
Route destination.
-
#device ⇒ String
Interface name.
-
#extrapara ⇒ String
Route options.
-
#gateway ⇒ String
Route gateway.
-
#netmask ⇒ String
Netmask.
Attributes inherited from SectionWithAttributes
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_network(route) ⇒ RouteSection
Clones a network route into an AutoYaST route section.
Instance Method Summary collapse
-
#init_from_hashes(hash) ⇒ Boolean
Method used by SectionWithAttributes.new_from_hashes to populate the attributes.
-
#init_from_route(route) ⇒ Boolean
Method used by RouteSection.new_from_network to populate the attributes when cloning a network route.
Methods inherited from SectionWithAttributes
#initialize, new_from_hashes, #section_name, #to_hashes
Constructor Details
This class inherits a constructor from Y2Network::AutoinstProfile::SectionWithAttributes
Instance Attribute Details
#destination ⇒ String
Returns Route destination.
|
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 48
|
#device ⇒ String
Returns Interface name.
|
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 51
|
#extrapara ⇒ String
Returns Route options.
|
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 54
|
#gateway ⇒ String
Returns Route gateway.
|
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 57
|
#netmask ⇒ String
Returns Netmask.
|
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 60
|
Class Method Details
.attributes ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 36 def self.attributes [ { name: :destination }, { name: :netmask }, { name: :device }, { name: :gateway }, { name: :extrapara } ] end |
.new_from_network(route) ⇒ RouteSection
Clones a network route into an AutoYaST route section
67 68 69 70 71 |
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 67 def self.new_from_network(route) result = new result.init_from_route(route) result end |
Instance Method Details
#init_from_hashes(hash) ⇒ Boolean
Method used by SectionWithAttributes.new_from_hashes to populate the attributes.
77 78 79 80 81 82 83 84 85 |
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 77 def init_from_hashes(hash) @destination = destination_from_hash(hash) @gateway = gateway_from_hash(hash) @netmask = netmask_from_hash(hash) @device = device_from_hash(hash) @extrapara = hash["extrapara"] true end |
#init_from_route(route) ⇒ Boolean
Method used by new_from_network to populate the attributes when cloning a network route
91 92 93 94 95 96 97 98 |
# File 'src/lib/y2network/autoinst_profile/route_section.rb', line 91 def init_from_route(route) @destination = destination_from_route(route) @netmask = netmask_from_route(route) @device = device_from_route(route) @gateway = gateway_from_route(route) @extrapara = extrapara_from_route(route) true end |