Class: Y2Issues::Presenter
- Inherits:
-
Object
- Object
- Y2Issues::Presenter
- 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
-
#issues ⇒ List
readonly
List of issues to present.
Instance Method Summary collapse
-
#initialize(issues) ⇒ Presenter
constructor
A new instance of Presenter.
-
#to_html ⇒ String
Return the HTML representation of a list of issues.
-
#to_plain ⇒ String
Return the text to be shown to the user regarding the list of issues.
Constructor Details
#initialize(issues) ⇒ Presenter
Returns a new instance of Presenter.
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
#issues ⇒ List (readonly)
Returns 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_html ⇒ String
Return the HTML representation of a 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 |