Class: Y2Issues::Presenter

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n
Defined in:
library/general/src/lib/y2issues/presenter.rb

Overview

TODO:

Separate by severity, group items, etc.

This class converts a list of issues into a message for users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issues) ⇒ Presenter

Returns a new instance of Presenter.

Parameters:

  • issues (List)

    Issues list



35
36
37
38
# File 'library/general/src/lib/y2issues/presenter.rb', line 35

def initialize(issues)
  textdomain "base"
  @issues = issues
end

Instance Attribute Details

#issuesList (readonly)

Returns List of issues to present.

Returns:

  • (List)

    List of issues to present



32
33
34
# File 'library/general/src/lib/y2issues/presenter.rb', line 32

def issues
  @issues
end

Instance Method Details

#to_htmlString

Return the HTML representation of a list of issues

Returns:

  • (String)

    HTML representing the list of issues



50
51
52
53
54
55
56
57
# File 'library/general/src/lib/y2issues/presenter.rb', line 50

def to_html
  errors, warnings = issues.partition(&:error?)
  parts = []
  parts << error_text(errors) unless errors.empty?
  parts << warning_text(warnings) unless warnings.empty?

  parts.join
end

#to_plainString

Return the text to be shown to the user regarding the list of issues

Returns:

  • (String)

    Plain text



43
44
45
# File 'library/general/src/lib/y2issues/presenter.rb', line 43

def to_plain
  Yast::RichText.Rich2Plain(to_html)
end