Class: Serega::SeregaPlugins::Batch::CheckBatchOptKey

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

Overview

Validator for option :key in attribute :batch option

Class Method Summary collapse

Class Method Details

.call(key) ⇒ void

This method returns an undefined value.

Checks option :key of attribute :batch option

Parameters:

  • key (nil, #call)

    Attribute :batch option :key

Raises:



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

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

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

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