diff --git a/lib/active_set.rb b/lib/active_set.rb index 2e61e69..ab69bce 100644 --- a/lib/active_set.rb +++ b/lib/active_set.rb @@ -47,8 +47,11 @@ def respond_to_missing?(method_name, include_private = false) # :nocov: def filter(instructions_hash) - filterer = Filtering::Operation.new(@view, instructions_hash) - reinitialize(filterer.execute, :filter, filterer.operation_instructions) + @filtered_set ||= Hash.new do |h, (view, instructions_hash)| + filterer = Filtering::Operation.new(view, instructions_hash) + h[[view, instructions_hash]] = reinitialize(filterer.execute, :filter, filterer.operation_instructions) + end + @filtered_set[[@view, instructions_hash]] end def sort(instructions_hash)