Class: ReporterHub

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
Library/Homebrew/cmd/update-report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReporterHub

Returns a new instance of ReporterHub.


407
408
409
410
# File 'Library/Homebrew/cmd/update-report.rb', line 407

def initialize
  @hash = {}
  @reporters = []
end

Instance Attribute Details

#reportersObject (readonly)

Returns the value of attribute reporters


405
406
407
# File 'Library/Homebrew/cmd/update-report.rb', line 405

def reporters
  @reporters
end

Instance Method Details

#add(reporter) ⇒ Object


416
417
418
419
420
# File 'Library/Homebrew/cmd/update-report.rb', line 416

def add(reporter)
  @reporters << reporter
  report = reporter.report.delete_if { |_k, v| v.empty? }
  @hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
end

#dumpObject


424
425
426
427
428
429
430
431
432
433
# File 'Library/Homebrew/cmd/update-report.rb', line 424

def dump
  # Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)

  dump_formula_report :A, "New Formulae"
  dump_formula_report :M, "Updated Formulae"
  dump_formula_report :R, "Renamed Formulae"
  dump_formula_report :D, "Deleted Formulae"
  dump_formula_report :MC, "Updated Casks"
  dump_formula_report :DC, "Deleted Casks"
end

#select_formula(key) ⇒ Object


412
413
414
# File 'Library/Homebrew/cmd/update-report.rb', line 412

def select_formula(key)
  @hash.fetch(key, [])
end