Class: Glyphs::PruneReport
- Inherits:
-
Object
- Object
- Glyphs::PruneReport
- Defined in:
- lib/glyphs/prune_report.rb
Overview
The result of an IconPruner run: per-(library, variant) counts, a sample of deleted names, and a human-readable summary. Value object, no side effects.
Defined Under Namespace
Classes: LibraryStat
Constant Summary collapse
- SAMPLE_LIMIT =
20
Instance Attribute Summary collapse
-
#deleted_names ⇒ Object
readonly
Returns the value of attribute deleted_names.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #bytes_freed ⇒ Object
- #deleted_count ⇒ Object
-
#initialize(stats:, deleted_names:, dry_run:) ⇒ PruneReport
constructor
A new instance of PruneReport.
- #kept_count ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(stats:, deleted_names:, dry_run:) ⇒ PruneReport
Returns a new instance of PruneReport.
13 14 15 16 17 |
# File 'lib/glyphs/prune_report.rb', line 13 def initialize(stats:, deleted_names:, dry_run:) @stats = stats @deleted_names = deleted_names @dry_run = dry_run end |
Instance Attribute Details
#deleted_names ⇒ Object (readonly)
Returns the value of attribute deleted_names.
11 12 13 |
# File 'lib/glyphs/prune_report.rb', line 11 def deleted_names @deleted_names end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
11 12 13 |
# File 'lib/glyphs/prune_report.rb', line 11 def dry_run @dry_run end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
11 12 13 |
# File 'lib/glyphs/prune_report.rb', line 11 def stats @stats end |
Instance Method Details
#bytes_freed ⇒ Object
21 |
# File 'lib/glyphs/prune_report.rb', line 21 def bytes_freed = stats.sum(&:bytes_freed) |
#deleted_count ⇒ Object
19 |
# File 'lib/glyphs/prune_report.rb', line 19 def deleted_count = stats.sum(&:deleted) |
#kept_count ⇒ Object
20 |
# File 'lib/glyphs/prune_report.rb', line 20 def kept_count = stats.sum(&:kept) |
#to_s ⇒ Object
23 24 25 26 27 28 |
# File 'lib/glyphs/prune_report.rb', line 23 def to_s lines = [headline, *stat_lines] lines << sample_line if deleted_names.any? lines << " Re-run with PRUNE=1 GLYPHS_PRUNE_ICONS=1 to delete." if dry_run lines.join("\n") end |