Class: Solid::Result::CallableAndThen::Caller

Inherits:
Object
  • Object
show all
Defined in:
lib/solid/result/callable_and_then/caller.rb

Direct Known Subclasses

Output::CallableAndThen::Caller

Class Method Summary collapse

Class Method Details

.call(source, value:, injected_value:, method_name:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/solid/result/callable_and_then/caller.rb', line 5

def self.call(source, value:, injected_value:, method_name:)
  method = callable_method(source, method_name)

  EventLogs.tracking.record_and_then(method, injected_value) do
    result =
      if source.is_a?(::Proc)
        call_proc!(source, value, injected_value)
      else
        call_method!(source, method, value, injected_value)
      end

    ensure_result_object(source, value, result)
  end
end