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
29
30
# 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)

  if loader.is_a?(Proc)
    check_block(loader)
  else
    check_callable(loader)
  end
end