class TestTube::Invoker

Evaluate an actual value invoking it with call method.

@api private

Public Class Methods

new(isolate:, matcher:, negate:, &input) click to toggle source

Class initializer.

@param isolate [Boolean] Compute in a subprocess. @param matcher [#matches?] A matcher. @param negate [Boolean] Invert the matcher or not. @param input [Proc] The callable object to test.

Calls superclass method
# File lib/test_tube/invoker.rb, line 20
def initialize(isolate:, matcher:, negate:, &input)
  super()

  @got = negate ^ matcher.matches? do
    value = if isolate
              send_call.to!(input)
            else
              send_call.to(input)
            end

    @actual = value.object
    value.call
  end
rescue ::Exception => e
  @actual = nil
  @error  = e
end

Private Instance Methods

send_call() click to toggle source

@return [::Defi::Challenge] The challenge for the callable object.

@see github.com/fixrb/defi/blob/v2.0.5/lib/defi/challenge.rb

# File lib/test_tube/invoker.rb, line 45
def send_call
  ::Defi.send(:call)
end