Class: Serega::SeregaPlugins::Batch::CheckBatchOptIdMethod

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

Overview

Validator for option :id_method in attribute :batch option

Class Method Summary collapse

Class Method Details

.call(id) ⇒ void

This method returns an undefined value.

Checks option :id_method of attribute :batch option

Parameters:

  • id (nil, #call)

    Attribute :batch option :id_method

Raises:



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

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

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

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