mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename @stubs to @spectator_stubs
This commit is contained in:
parent
3befc8001b
commit
b09898d131
1 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@ require "./method_stub"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
abstract class Double
|
abstract class Double
|
||||||
@stubs = Deque(MethodStub).new
|
@spectator_stubs = Deque(MethodStub).new
|
||||||
|
|
||||||
private macro stub(definition, &block)
|
private macro stub(definition, &block)
|
||||||
{%
|
{%
|
||||||
|
@ -28,7 +28,7 @@ module Spectator
|
||||||
{% if name.ends_with?('=') && name.id != "[]=" %}
|
{% if name.ends_with?('=') && name.id != "[]=" %}
|
||||||
def {{name}}(arg)
|
def {{name}}(arg)
|
||||||
call = ::Spectator::MethodCall.new({{name.symbolize}}, {arg}, NamedTuple.new)
|
call = ::Spectator::MethodCall.new({{name.symbolize}}, {arg}, NamedTuple.new)
|
||||||
stub = @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)
|
||||||
else
|
else
|
||||||
|
@ -38,7 +38,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::MethodCall.new({{name.symbolize}}, args, options)
|
call = ::Spectator::MethodCall.new({{name.symbolize}}, args, options)
|
||||||
stub = @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)
|
||||||
else
|
else
|
||||||
|
@ -49,7 +49,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::MethodCall.new({{name.symbolize}}, args, options)
|
call = ::Spectator::MethodCall.new({{name.symbolize}}, args, options)
|
||||||
stub = @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)
|
||||||
else
|
else
|
||||||
|
@ -77,7 +77,7 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def spectator_define_stub(stub : MethodStub) : Nil
|
protected def spectator_define_stub(stub : MethodStub) : Nil
|
||||||
@stubs << stub
|
@spectator_stubs << stub
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue