Module: Y2Network::Presenters::Summary

Includes:
Yast::Logger
Defined in:
src/lib/y2network/presenters/summary.rb

Class Method Summary collapse

Class Method Details

.for(config, section) ⇒ Object

Config summary for a given section

Parameters:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'src/lib/y2network/presenters/summary.rb', line 42

def for(config, section)
  require "y2network/presenters/#{section}_summary"
  summary_class =
    case section
    when "config"
      ConfigSummary
    when "proposal"
      ProposalSummary
    when "interfaces"
      InterfacesSummary
    when "routing"
      RoutingSummary
    when "dns"
      DNSSummary
    end
  summary_class&.new(config)
rescue LoadError => e
  log.error "Specialized summary for #{section} not found. #{e.inspect}"
  nil
end

.text_for(config, section, type = "text") ⇒ String

Config summary text for a given section

Returns:

  • (String)


31
32
33
34
35
36
# File 'src/lib/y2network/presenters/summary.rb', line 31

def text_for(config, section, type = "text")
  summary = self.for(config, section)
  return "" unless summary

  summary.public_send(type)
end