Class: Yast::SummaryClass

Inherits:
Module
  • Object
show all
Defined in:
../../library/general/src/modules/Summary.rb

Instance Method Summary (collapse)

Instance Method Details

- (String) AddHeader(summary, header)

Add a RichText section header to an existing summary.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

  • header (String)

    header to add (plain text, no HTML)

Returns:

  • (String)

    the new summary including the new header



108
109
110
# File '../../library/general/src/modules/Summary.rb', line 108

def AddHeader(summary, header)
  Ops.add(Ops.add(Ops.add(summary, "<h3>"), header), "</h3>")
end

- (String) AddLine(summary, line)

Add a line to an existing summary.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

  • line (String)

    line to add (plain text, no HTML)

Returns:

  • (String)

    the new summary including the new line



117
118
119
# File '../../library/general/src/modules/Summary.rb', line 117

def AddLine(summary, line)
  Ops.add(Ops.add(Ops.add(summary, "<p>"), line), "</p>")
end

- (String) AddListItem(summary, item)

Add a list item to an existing summary. Requires a previous call to 'summaryOpenList()'.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

  • item (String)

    item to add (plain text, no HTML)

Returns:

  • (String)

    the new summary including the new line



151
152
153
# File '../../library/general/src/modules/Summary.rb', line 151

def AddListItem(summary, item)
  Ops.add(Ops.add(Ops.add(summary, "\n<li>"), item), "</li>")
end

- (String) AddNewLine(summary)

Add a newline to an existing summary.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

Returns:

  • (String)

    the new summary



125
126
127
# File '../../library/general/src/modules/Summary.rb', line 125

def AddNewLine(summary)
  Ops.add(summary, "<br>")
end

- (String) AddSimpleSection(summary, header, item)

Add a simple section to an existing summary, consisting of a header and one single item.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

  • header (String)

    section header (plain text, no HTML)

  • item (String)

    section item (plain text, no HTML)

Returns:

  • (String)

    the new summary including the new line



162
163
164
165
166
167
168
169
# File '../../library/general/src/modules/Summary.rb', line 162

def AddSimpleSection(summary, header, item)
  summary = AddHeader(summary, header)
  summary = OpenList(summary)
  summary = AddListItem(summary, item)
  summary = CloseList(summary)

  summary
end

- (String) CloseList(summary)

End a list within a summary.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

Returns:

  • (String)

    the new summary



141
142
143
# File '../../library/general/src/modules/Summary.rb', line 141

def CloseList(summary)
  Ops.add(summary, "</ul>")
end

- (String) Device(name, description)

Function that creates description of one device.

Parameters:

  • name (String)

    The name of the device given by probing

  • description (String)

    Additional description (how it was confgured or so)

Returns:

  • (String)

    String with the item.



99
100
101
# File '../../library/general/src/modules/Summary.rb', line 99

def Device(name, description)
  Builtins.sformat("<li><p>%1<br>%2</p></li>", name, description)
end

- (String) DevicesList(devices)

Function that creates the whole final product. “Not detected” will be returned if the list is empty.

Parameters:

  • devices (Array<String>)

    A list of output of the summaryDevice() calls

Returns:

  • (String)

    The resulting text.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File '../../library/general/src/modules/Summary.rb', line 76

def DevicesList(devices)
  devices = deep_copy(devices)
  text = ""
  if Builtins.size(devices) == 0
    if !Mode.config
      # translators: summary if no hardware was detected
      text = Builtins.sformat("<ul><li>%1</li></ul>", _("Not detected."))
    else
      text = Builtins.sformat("<ul><li>%1</li></ul>", NotConfigured())
    end
  else
    Builtins.foreach(devices) { |dev| text = Ops.add(text, dev) }
    text = Builtins.sformat("<ul>%1</ul>", text)
  end

  text
end

- (Object) main



58
59
60
61
62
# File '../../library/general/src/modules/Summary.rb', line 58

def main
  textdomain "base"

  Yast.import "Mode"
end

- (Object) NotConfigured

Function that creates a 'Not configured.' message.

Returns:

  • String with the message.



66
67
68
69
# File '../../library/general/src/modules/Summary.rb', line 66

def NotConfigured
  # translators: summary if the module has not been used yet in AutoYaST profile
  _("Not configured yet.")
end

- (String) OpenList(summary)

Start a list within a summary.

Parameters:

  • summary (String)

    previous RichText (HTML) summary to add to

Returns:

  • (String)

    the new summary



133
134
135
# File '../../library/general/src/modules/Summary.rb', line 133

def OpenList(summary)
  Ops.add(summary, "<ul>")
end