Class: LogStruct::MultiErrorReporter::CallableReporterWrapper

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/log_struct/multi_error_reporter.rb

Overview

Class variable to store the selected reporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ void

Parameters:

  • callable (T.untyped)


27
28
29
# File 'lib/log_struct/multi_error_reporter.rb', line 27

def initialize(callable)
  @callable = callable
end

Instance Attribute Details

#callableT.untyped (readonly) Also known as: original

Returns:

  • (T.untyped)


32
33
34
# File 'lib/log_struct/multi_error_reporter.rb', line 32

def callable
  @callable
end

Instance Method Details

#call(error, context, source) ⇒ void

This method returns an undefined value.

Parameters:

  • error (StandardError)
  • context (Hash{Symbol => T.untyped}, nil)
  • source (Source)


36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/log_struct/multi_error_reporter.rb', line 36

def call(error, context, source)
  case callable_arity
  when 3
    callable.call(error, context, source)
  when 2
    callable.call(error, context)
  when 1
    callable.call(error)
  else
    callable.call(error, context, source)
  end
end