Class: Serega::SeregaPlugins::Batch::CheckBatchOptLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/batch/lib/validations/check_batch_opt_loader.rb

Overview

Validator for option :loader in attribute :batch option

Class Method Summary collapse

Class Method Details

.call(loader) ⇒ void

This method returns an undefined value.

Checks option :loader of attribute :batch option

Parameters:

  • loader (nil, #call)

    Attribute :batch option :loader

Raises:



20
21
22
23
24
25
26
27
28
# File 'lib/serega/plugins/batch/lib/validations/check_batch_opt_loader.rb', line 20

def call(loader)
  return if loader.is_a?(Symbol)

  raise SeregaError, must_be_callable unless loader.respond_to?(:call)

  SeregaValidations::Utils::CheckExtraKeywordArg.call(loader, ":batch option :loader")
  params_count = SeregaUtils::ParamsCount.call(loader, max_count: 3)
  raise SeregaError, params_count_error if params_count > 3
end