Class: CheekyDreams::SuppressDuplicatesAuditor

Inherits:
Object
  • Object
show all
Defined in:
lib/cheeky-dreams.rb

Instance Method Summary collapse

Constructor Details

#initialize(auditor) ⇒ SuppressDuplicatesAuditor

Returns a new instance of SuppressDuplicatesAuditor.



79
80
81
# File 'lib/cheeky-dreams.rb', line 79

def initialize auditor
  @auditor, @audits = auditor, Set.new
end

Instance Method Details

#audit(type, message) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/cheeky-dreams.rb', line 83

def audit type, message
  event = AuditEvent.new type, message
  unless @audits.include?(event)
    @auditor.audit(type, message)
    @audits << event
  end
end