Class: Installation::SshImporterPresenter
- Inherits:
-
Object
- Object
- Installation::SshImporterPresenter
- Includes:
- Yast::I18n
- Defined in:
- src/lib/installation/ssh_importer_presenter.rb
Overview
This class is responsible for building a summary for SshImporter objects. Moving the presentation to a different class, avoid SshImporter knowing about i18n and HTML.
Instance Attribute Summary collapse
-
#importer ⇒ SshImporter
readonly
Importer.
Instance Method Summary collapse
-
#initialize(importer) ⇒ SshImporterPresenter
constructor
A new instance of SshImporterPresenter.
-
#summary ⇒ String
Build a formatted summary based on the status of the importer.
Constructor Details
#initialize(importer) ⇒ SshImporterPresenter
Returns a new instance of SshImporterPresenter.
31 32 33 34 35 36 37 |
# File 'src/lib/installation/ssh_importer_presenter.rb', line 31 def initialize(importer) Yast.import "Mode" Yast.import "HTML" textdomain "installation" @importer = importer end |
Instance Attribute Details
#importer ⇒ SshImporter (readonly)
Returns Importer.
29 30 31 |
# File 'src/lib/installation/ssh_importer_presenter.rb', line 29 def importer @importer end |
Instance Method Details
#summary ⇒ String
Build a formatted summary based on the status of the importer
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'src/lib/installation/ssh_importer_presenter.rb', line 42 def summary = if importer.configurations.empty? && (Yast::Mode.installation || Yast::Mode.autoinst) _("No previous Linux installation found") elsif importer.device.nil? _("No existing SSH host keys will be copied") else name = ssh_config.system_name if ssh_config name ||= importer.device || "default" if importer.copy_config? # TRANSLATORS: %s is the name of a Linux system found in the hard # disk, like 'openSUSE 13.2' _("SSH host keys and configuration will be copied from %s") % name else # TRANSLATORS: %s is the name of a Linux system found in the hard # disk, like 'openSUSE 13.2' _("SSH host keys will be copied from %s") % name end end Yast::HTML.List([]) end |