Class: Y2Network::Presenters::InterfacesSummary

Inherits:
Object
  • Object
show all
Includes:
InterfaceStatus, Yast::I18n, Yast::Logger
Defined in:
src/lib/y2network/presenters/interfaces_summary.rb

Overview

This class converts a connection config configurations into a string to be used in an AutoYaST summary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from InterfaceStatus

#status_info

Constructor Details

#initialize(config) ⇒ InterfacesSummary


38
39
40
# File 'src/lib/y2network/presenters/interfaces_summary.rb', line 38

def initialize(config)
  @config = config
end

Instance Attribute Details

#configConfig (readonly)


36
37
38
# File 'src/lib/y2network/presenters/interfaces_summary.rb', line 36

def config
  @config
end

Instance Method Details

#textObject


42
43
44
45
46
47
48
49
50
51
52
# File 'src/lib/y2network/presenters/interfaces_summary.rb', line 42

def text
  overview = config.interfaces.map do |interface|
    connection = config.connections.by_name(interface.name)
    descr = interface.hardware ? interface.hardware.description : ""
    descr = interface.name if descr.empty?
    status = connection ? status_info(connection) : Yast::Summary.NotConfigured
    Yast::Summary.Device(descr, status)
  end

  Yast::Summary.DevicesList(overview)
end