Yield instead of forwarding block

Forwarding the block like this captures it, which prevents yield from 
being used.
Addresses https://gitlab.com/arctic-fox/spectator/-/issues/54
This commit is contained in:
Michael Miller 2020-09-27 10:14:30 -06:00
parent a39223ff21
commit 0970f02465
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -17,7 +17,7 @@ module Spectator::Mocks
abstract def call(args : GenericArguments(T, NT), &original : -> RT) forall T, NT, RT
def call!(args : GenericArguments(T, NT), &original : -> RT) : RT forall T, NT, RT
value = call(args, &original)
value = call(args) { |*ya| yield *ya }
if value.is_a?(RT)
value.as(RT)
else