Class: Packages::UpdateMessagesView

Inherits:
Object
  • Object
show all
Extended by:
Yast::I18n
Includes:
Yast::I18n
Defined in:
library/packages/src/lib/packages/update_messages_view.rb

Overview

This class converts a set of libzypp update messages into string representations.

At this time, richtext is the only provided conversion.

Instance Method Summary collapse

Constructor Details

#initialize(messages) ⇒ UpdateMessagesView

Returns a new instance of UpdateMessagesView

Parameters:



13
14
15
16
17
# File 'library/packages/src/lib/packages/update_messages_view.rb', line 13

def initialize(messages)
  Yast.import "String"
  textdomain "base"
  @messages = messages
end

Instance Method Details

#richtextString

Gets richtext representation of messages passed to constructor

Returns:

  • (String)

    Richtext representation of the list of messages



22
23
24
25
26
27
# File 'library/packages/src/lib/packages/update_messages_view.rb', line 22

def richtext
  text = "<h1>" + _("Packages notifications") + "</h1>\n<p>" \
    + _("You have notifications from the following packages:") + "</p>"
  text << richtext_toc(@messages) if @messages.size > 1
  text << @messages.map { |m| message_to_richtext(m) }.join("<hr>")
end