mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Record call to stub
This commit is contained in:
parent
76fa7e294f
commit
3dd691a990
1 changed files with 3 additions and 0 deletions
|
@ -33,6 +33,7 @@ module Spectator
|
||||||
{% if name.ends_with?('=') && name.id != "[]=" %}
|
{% if name.ends_with?('=') && name.id != "[]=" %}
|
||||||
def {{name}}(arg)
|
def {{name}}(arg)
|
||||||
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, {arg}, NamedTuple.new)
|
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, {arg}, NamedTuple.new)
|
||||||
|
@spectator_stub_calls << call
|
||||||
stub = @spectator_stubs.find(&.callable?(call))
|
stub = @spectator_stubs.find(&.callable?(call))
|
||||||
if stub
|
if stub
|
||||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(arg)))).call(call)
|
stub.as(::Spectator::GenericMethodStub(typeof(%method(arg)))).call(call)
|
||||||
|
@ -43,6 +44,7 @@ module Spectator
|
||||||
{% else %}
|
{% else %}
|
||||||
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
||||||
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, args, options)
|
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, args, options)
|
||||||
|
@spectator_stub_calls << call
|
||||||
stub = @spectator_stubs.find(&.callable?(call))
|
stub = @spectator_stubs.find(&.callable?(call))
|
||||||
if stub
|
if stub
|
||||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options)))).call(call)
|
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options)))).call(call)
|
||||||
|
@ -54,6 +56,7 @@ module Spectator
|
||||||
{% if name != "[]=" %}
|
{% if name != "[]=" %}
|
||||||
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
||||||
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, args, options)
|
call = ::Spectator::GenericMethodCall.new({{name.symbolize}}, args, options)
|
||||||
|
@spectator_stub_calls << call
|
||||||
stub = @spectator_stubs.find(&.callable?(call))
|
stub = @spectator_stubs.find(&.callable?(call))
|
||||||
if stub
|
if stub
|
||||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options) { |*yield_args| yield *yield_args }))).call(call)
|
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options) { |*yield_args| yield *yield_args }))).call(call)
|
||||||
|
|
Loading…
Reference in a new issue