Method: Hyperstack::Internal::State::Mapper.observers_to_update

Defined in:
lib/hyperstack/internal/state/mapper.rb

.observers_to_update(exclusions) ⇒ Object

observers_to_update returns a hash with observers as keys, and lists of objects as values. The hash is built by filtering the current_observers list including only observers that have mutated objects, that are not on the exclusion list.



260
261
262
263
264
265
266
267
268
269
# File 'lib/hyperstack/internal/state/mapper.rb', line 260

def observers_to_update(exclusions)
  Hash.new { |hash, key| hash[key] = Array.new }.tap do |updates|
    exclusions.each do |object, excluded_observers|
      current_observers[object].each do |observer|
        next if excluded_observers.include?(observer)
        updates[observer] << object
      end if current_observers.key? object
    end
  end
end