Class: Package::Audit::PackagePrinter
- Inherits:
-
Object
- Object
- Package::Audit::PackagePrinter
- Defined in:
- lib/package/audit/services/package_printer.rb
Constant Summary collapse
- BASH_FORMATTING_REGEX =
/\e\[\d+(?:;\d+)*m/
- COLUMN_GAP =
2
Instance Method Summary collapse
-
#initialize(options, pkgs) ⇒ PackagePrinter
constructor
A new instance of PackagePrinter.
- #print(fields) ⇒ Object
Constructor Details
#initialize(options, pkgs) ⇒ PackagePrinter
Returns a new instance of PackagePrinter.
15 16 17 18 |
# File 'lib/package/audit/services/package_printer.rb', line 15 def initialize(, pkgs) @options = @pkgs = pkgs end |
Instance Method Details
#print(fields) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/package/audit/services/package_printer.rb', line 20 def print(fields) check_fields(fields) return if @pkgs.empty? case @options[Enum::Option::FORMAT] when Enum::Format::CSV csv(fields, exclude_headers: @options[Enum::Option::CSV_EXCLUDE_HEADERS]) when Enum::Format::MARKDOWN markdown(fields) else pretty(fields) end puts end |