Class: AuditLoggable::AuditRecordSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/audit_loggable/audit_record_set.rb

Instance Method Summary collapse

Constructor Details

#initializeAuditRecordSet

Returns a new instance of AuditRecordSet.



9
10
11
# File 'lib/audit_loggable/audit_record_set.rb', line 9

def initialize
  clear
end

Instance Method Details

#<<(audit_record) ⇒ Object



13
14
15
16
# File 'lib/audit_loggable/audit_record_set.rb', line 13

def <<(audit_record)
  set << audit_record
  self
end

#clearObject



18
19
20
21
# File 'lib/audit_loggable/audit_record_set.rb', line 18

def clear
  @set = []
  self
end

#each(&block) ⇒ Object



23
24
25
26
27
28
# File 'lib/audit_loggable/audit_record_set.rb', line 23

def each(&block)
  return to_enum unless block

  set.each(&block)
  self
end

#flushObject



30
31
32
33
# File 'lib/audit_loggable/audit_record_set.rb', line 30

def flush
  ::AuditLoggable.logger.log(set)
  clear
end