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
|
||||
abstract class Double
|
||||
@stubs = Deque(MethodStub).new
|
||||
@spectator_stubs = Deque(MethodStub).new
|
||||
|
||||
private macro stub(definition, &block)
|
||||
{%
|
||||
|
@ -28,7 +28,7 @@ module Spectator
|
|||
{% if name.ends_with?('=') && name.id != "[]=" %}
|
||||
def {{name}}(arg)
|
||||
call = ::Spectator::MethodCall.new({{name.symbolize}}, {arg}, NamedTuple.new)
|
||||
stub = @stubs.find(&.callable?(call))
|
||||
stub = @spectator_stubs.find(&.callable?(call))
|
||||
if stub
|
||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(arg)))).call(call)
|
||||
else
|
||||
|
@ -38,7 +38,7 @@ module Spectator
|
|||
{% else %}
|
||||
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
||||
call = ::Spectator::MethodCall.new({{name.symbolize}}, args, options)
|
||||
stub = @stubs.find(&.callable?(call))
|
||||
stub = @spectator_stubs.find(&.callable?(call))
|
||||
if stub
|
||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options)))).call(call)
|
||||
else
|
||||
|
@ -49,7 +49,7 @@ module Spectator
|
|||
{% if name != "[]=" %}
|
||||
def {{name}}(*args, **options){% if definition.is_a?(TypeDeclaration) %} : {{definition.type}}{% end %}
|
||||
call = ::Spectator::MethodCall.new({{name.symbolize}}, args, options)
|
||||
stub = @stubs.find(&.callable?(call))
|
||||
stub = @spectator_stubs.find(&.callable?(call))
|
||||
if stub
|
||||
stub.as(::Spectator::GenericMethodStub(typeof(%method(*args, **options) { |*yield_args| yield *yield_args }))).call(call)
|
||||
else
|
||||
|
@ -77,7 +77,7 @@ module Spectator
|
|||
end
|
||||
|
||||
protected def spectator_define_stub(stub : MethodStub) : Nil
|
||||
@stubs << stub
|
||||
@spectator_stubs << stub
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue