Class: Y2Network::Presenters::RoutingSummary

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n
Defined in:
src/lib/y2network/presenters/routing_summary.rb

Overview

This class converts a routing configuration object into a string to be used in an AutoYaST summary

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ RoutingSummary

Constructor

Parameters:



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

def initialize(config)
  textdomain "network"
  @routing = config.routing
end

Instance Attribute Details

#routingY2Network::Routing (readonly)

Returns:



32
33
34
# File 'src/lib/y2network/presenters/routing_summary.rb', line 32

def routing
  @routing
end

Instance Method Details

#textString

TODO:

Implement the real summary.

Returns the summary of network configuration settings in text form

Returns:

  • (String)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'src/lib/y2network/presenters/routing_summary.rb', line 47

def text
  summary = ""
  return summary if routing.nil?

  gateways = gateways_string(routing)
  if gateways
    summary = Yast::Summary.AddListItem(summary, format(_("Gateways: %s"), gateways))
  end
  summary = Yast::Summary.AddListItem(
    summary, format(_("IP Forwarding for IPv4: %s"), boolean_to_human(routing.forward_ipv4))
  )
  summary = Yast::Summary.AddListItem(
    summary, format(_("IP Forwarding for IPv6: %s"), boolean_to_human(routing.forward_ipv6))
  )

  "<ul>#{summary}</ul>"
end