Class: ReporterHub
- Inherits:
-
Object
- Object
- ReporterHub
- Extended by:
- Forwardable
- Defined in:
- Library/Homebrew/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 ⇒ ReporterHub
constructor
A new instance of ReporterHub.
- #select_formula(key) ⇒ Object
Constructor Details
#initialize ⇒ ReporterHub
Returns a new instance of ReporterHub.
420 421 422 423 |
# File 'Library/Homebrew/cmd/update-report.rb', line 420 def initialize @hash = {} @reporters = [] end |
Instance Attribute Details
#reporters ⇒ Object (readonly)
Returns the value of attribute reporters
418 419 420 |
# File 'Library/Homebrew/cmd/update-report.rb', line 418 def reporters @reporters end |
Instance Method Details
#add(reporter, preinstall: false) ⇒ Object
429 430 431 432 433 |
# File 'Library/Homebrew/cmd/update-report.rb', line 429 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
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'Library/Homebrew/cmd/update-report.rb', line 437 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 if updated.positive? ohai "Updated Formulae" puts "Updated #{updated} #{"formula".pluralize(updated)}." end end dump_formula_report :R, "Renamed Formulae" dump_formula_report :D, "Deleted Formulae" dump_formula_report :AC, "New Casks" dump_formula_report :MC, "Updated Casks" dump_formula_report :DC, "Deleted Casks" end |
#select_formula(key) ⇒ Object
425 426 427 |
# File 'Library/Homebrew/cmd/update-report.rb', line 425 def select_formula(key) @hash.fetch(key, []) end |