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



555
556
557
558
# File 'Library/Homebrew/cmd/update-report.rb', line 555

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

Instance Attribute Details

#reportersObject (readonly)

Returns the value of attribute reporters



553
554
555
# File 'Library/Homebrew/cmd/update-report.rb', line 553

def reporters
  @reporters
end

Instance Method Details

#add(reporter) ⇒ Object



564
565
566
567
568
# File 'Library/Homebrew/cmd/update-report.rb', line 564

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



572
573
574
575
576
577
578
579
# File 'Library/Homebrew/cmd/update-report.rb', line 572

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"
end

#select_formula(key) ⇒ Object



560
561
562
# File 'Library/Homebrew/cmd/update-report.rb', line 560

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