Class: Umwelt::History::Aggregate

Inherits:
Object
  • Object
show all
Includes:
Hanami::Interactor
Defined in:
lib/umwelt/history/aggregate.rb

Instance Method Summary collapse

Constructor Details

#initializeAggregate

Returns a new instance of Aggregate.



9
10
11
12
# File 'lib/umwelt/history/aggregate.rb', line 9

def initialize
  @engaged = {}
  @forgotten = []
end

Instance Method Details

#call(episodes) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/umwelt/history/aggregate.rb', line 14

def call(episodes)
  episodes.each do |episode|
    index_engaged(episode.engaged)
    collect_forgotten(episode.forgotten)
  end

  verify_consistency

  @fragments = @engaged.slice(*alive_ids).values
end