Module: Audits1984::Session::Iterable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/audits1984/session/iterable.rb
Instance Method Summary collapse
-
#each_batch_of_commands_grouped_by_sensitive_access ⇒ Object
Loops through all the session commands in order, yielding lists grouped by its sensitive access record, or its absence.
Instance Method Details
#each_batch_of_commands_grouped_by_sensitive_access ⇒ Object
Loops through all the session commands in order, yielding lists grouped by its sensitive access record, or its absence
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/audits1984/session/iterable.rb', line 6 def each_batch_of_commands_grouped_by_sensitive_access group = [] current_sensitive_access = nil commands.includes(:sensitive_access).sorted_chronologically.each.with_index do |command, index| current_sensitive_access = command.sensitive_access if index == 0 if index > 0 && command.sensitive_access != current_sensitive_access yield current_sensitive_access, group group = [] current_sensitive_access = command.sensitive_access end group << command end if group.present? yield current_sensitive_access, group end end |