Class: ReporterHub

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReporterHub

Returns a new instance of ReporterHub



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

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

Instance Attribute Details

#reportersObject (readonly)

Returns the value of attribute reporters



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

def reporters
  @reporters
end

Instance Method Details

#add(reporter) ⇒ Object



420
421
422
423
424
# File 'brew/Library/Homebrew/cmd/update-report.rb', line 420

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



428
429
430
431
432
433
434
435
# File 'brew/Library/Homebrew/cmd/update-report.rb', line 428

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



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

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