Sha256: 3565edf62d9d21f5bf341a027f70a0f4a58fa86b0deeef4e5e64dd6e53d969b7

Contents?: true

Size: 613 Bytes

Versions: 19

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module IdentityCache
  module LoadStrategy
    class MultiLoadRequest
      def initialize(load_requests)
        @load_requests = load_requests
      end

      def db_keys
        @load_requests.flat_map(&:db_keys).tap(&:uniq!)
      end

      def after_load(all_results)
        @load_requests.each do |load_request|
          load_result = {}
          load_request.db_keys.each do |key|
            load_result[key] = all_results[key]
          end
          load_request.after_load(load_result)
        end
      end
    end

    private_constant :MultiLoadRequest
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
identity_cache-1.6.3 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.6.2 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.6.1 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.6.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.6 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.5 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.4 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.3 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.2 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.1 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.5.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.4.1 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.4.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.3.1 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.3.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.2.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.1.0 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.0.1 lib/identity_cache/load_strategy/multi_load_request.rb
identity_cache-1.0.0 lib/identity_cache/load_strategy/multi_load_request.rb