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) ⇒ CallableReporterWrapper

Returns a new instance of CallableReporterWrapper.



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

def initialize(callable)
  @callable = callable
end

Instance Attribute Details

#callableObject (readonly) Also known as: original

Returns the value of attribute callable.



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

def callable
  @callable
end

Instance Method Details

#call(error, context, source) ⇒ Object



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