Method: Hyperstack::Internal::State::Mapper.remove_current_observers_and_objects
- Defined in:
- lib/hyperstack/internal/state/mapper.rb
.remove_current_observers_and_objects(observer) ⇒ Object
remove_current_observers_and_objects clears the hashes between renders
189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/hyperstack/internal/state/mapper.rb', line 189 def remove_current_observers_and_objects(observer) raise 'state management called outside of watch block' unless observer deleted_objects = current_objects.delete(observer) return unless deleted_objects deleted_objects.each do |object| # to allow for GC we never want objects hanging around as keys in # the current_observers hash, so we tread carefully here. next unless current_observers.key? object current_observers[object].delete(observer) current_observers.delete object if current_observers[object].empty? end end |