Class: ReporterHub
- Inherits:
-
Object
- Object
- ReporterHub
- Extended by:
- Forwardable, T::Sig
- Defined in:
- cmd/update-report.rb
Instance Attribute Summary collapse
-
#reporters ⇒ Object
readonly
Returns the value of attribute reporters.
Instance Method Summary collapse
-
#add(reporter, preinstall: false) ⇒ Object
-
#dump(updated_formula_report: true) ⇒ Object
-
#initialize ⇒ void
constructor
-
#select_formula(key) ⇒ Object
Constructor Details
#initialize ⇒ void
564 565 566 567 |
# File 'cmd/update-report.rb', line 564 def initialize @hash = {} @reporters = [] end |
Instance Attribute Details
#reporters ⇒ Object (readonly)
Returns the value of attribute reporters.
561 562 563 |
# File 'cmd/update-report.rb', line 561 def reporters @reporters end |
Instance Method Details
#add(reporter, preinstall: false) ⇒ Object
573 574 575 576 577 |
# File 'cmd/update-report.rb', line 573 def add(reporter, preinstall: false) @reporters << reporter report = reporter.report(preinstall: preinstall).delete_if { |_k, v| v.empty? } @hash.update(report) { |_key, oldval, newval| oldval.concat(newval) } end |
#dump(updated_formula_report: true) ⇒ Object
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'cmd/update-report.rb', line 581 def dump(updated_formula_report: true) # Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) dump_formula_report :A, "New Formulae" if updated_formula_report dump_formula_report :M, "Updated Formulae" else updated = select_formula(:M).count ohai "Updated Formulae", "Updated #{updated} #{"formula".pluralize(updated)}." if updated.positive? end dump_formula_report :R, "Renamed Formulae" dump_formula_report :D, "Deleted Formulae" dump_formula_report :AC, "New Casks" if updated_formula_report dump_formula_report :MC, "Updated Casks" else updated = select_formula(:MC).count ohai "Updated Casks", "Updated #{updated} #{"cask".pluralize(updated)}." if updated.positive? end dump_formula_report :DC, "Deleted Casks" end |
#select_formula(key) ⇒ Object
569 570 571 |
# File 'cmd/update-report.rb', line 569 def select_formula(key) @hash.fetch(key, []) end |