Sha256: 96a0a5d96f252464d39b8bf228ff56a1c8b26a4aaf97af1c28697a794ef00ffa

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

class Serega
  module SeregaPlugins
    module Batch
      #
      # Serega::SeregaPlanPoint additional/patched class methods
      #
      # @see SeregaAttribute
      #
      module PlanPointInstanceMethods
        #
        # Returns attribute :batch option with prepared loader
        # @return [Hash] attribute :batch option
        #
        attr_reader :batch

        private

        def set_normalized_vars
          super
          @batch = prepare_batch
        end

        def prepare_batch
          batch = attribute.batch
          if batch
            loader = batch[:loader]
            if loader.is_a?(Symbol)
              batch_config = attribute.class.serializer_class.config.batch
              batch[:loader] = batch_config.fetch_loader(loader)
            end
          end
          batch
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
serega-0.17.0 lib/serega/plugins/batch/lib/modules/plan_point.rb
serega-0.16.0 lib/serega/plugins/batch/lib/modules/plan_point.rb
serega-0.15.0 lib/serega/plugins/batch/lib/modules/plan_point.rb
serega-0.14.0 lib/serega/plugins/batch/lib/modules/plan_point.rb
serega-0.12.0 lib/serega/plugins/batch/lib/modules/plan_point.rb
serega-0.11.2 lib/serega/plugins/batch/lib/modules/plan_point.rb