Sha256: e2a9c32cab5208a54f5631b24501cb148975a3bba17a489edd0478721f09778c

Contents?: true

Size: 502 Bytes

Versions: 21

Compression:

Stored size: 502 Bytes

Contents

# frozen_string_literal: true

module N1Loader
  module ArLazyPreload
    # A patch to {N1Loader::Preloader} setup lazy context lazily.
    module PreloaderPatch
      def initialize(elements, context_setup = nil)
        super(elements)
        @context_setup = context_setup
      end

      def preload(*keys)
        super.each do |loader_collection|
          loader_collection.context_setup = context_setup
        end
      end

      private

      attr_reader :context_setup
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
n1_loader-1.2.0 lib/n1_loader/ar_lazy_preload/preloader_patch.rb