Class: FeduxOrgStdlib::SupportInformation
- Inherits:
-
Object
- Object
- FeduxOrgStdlib::SupportInformation
- Defined in:
- lib/fedux_org_stdlib/support_information.rb
Instance Method Summary collapse
-
#initialize(logger: FeduxOrgStdlib::Logging::Logger.new) ⇒ SupportInformation
constructor
A new instance of SupportInformation.
-
#to_s ⇒ String
Output support information as string.
Constructor Details
#initialize(logger: FeduxOrgStdlib::Logging::Logger.new) ⇒ SupportInformation
Returns a new instance of SupportInformation.
12 13 14 |
# File 'lib/fedux_org_stdlib/support_information.rb', line 12 def initialize(logger: FeduxOrgStdlib::Logging::Logger.new) @logger = logger end |
Instance Method Details
#to_s ⇒ String
Output support information as string
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fedux_org_stdlib/support_information.rb', line 20 def to_s result = [] max_field_length = determine_max_field_length(facter_fields) result << format("%#{max_field_length}s | %s", 'Information', 'Value') result << format("%s + %s", '-' * max_field_length, '-' * 40) result.concat system_information.sort_by { |key, value| key }.map { |key, value| format("%#{max_field_length}s | %s", key, value) } result << "" result << "" result << "" max_field_length = determine_max_field_length(rubygems_information.keys) result << format("%#{max_field_length}s | %s", 'Information', 'Value') result << format("%s + %s", '-' * max_field_length, '-' * 40) result.concat rubygems_information.sort_by { |key, value| key }.map { |key, value| format("%#{max_field_length}s | %s", key, value) } result << "" result << "" result << "" max_field_length = determine_max_field_length(installed_rubygems.keys) result << format("%#{max_field_length}s | %s", 'Name', 'version') result << format("%s + %s", '-' * max_field_length, '-' * 40) result.concat installed_rubygems.sort_by { |key, value| key }.map { |key, value| format("%#{max_field_length}s | %s", key, value) } result.join "\n" end |