mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename Proxy to Wrapper
This commit is contained in:
parent
a0fbc61244
commit
5eb5561e61
3 changed files with 7 additions and 7 deletions
|
@ -52,14 +52,14 @@ module Spectator
|
||||||
let!({{name}}!) {{block}}
|
let!({{name}}!) {{block}}
|
||||||
|
|
||||||
module Context
|
module Context
|
||||||
@_%proxy : ValueProxy?
|
@_%wrapper : ValueWrapper?
|
||||||
|
|
||||||
def {{name.id}}
|
def {{name.id}}
|
||||||
if (proxy = @_%proxy)
|
if (wrapper = @_%wrapper)
|
||||||
proxy.as(TypedValueProxy(typeof({{name.id}}!))).value
|
wrapper.as(TypedValueWrapper(typeof({{name.id}}!))).value
|
||||||
else
|
else
|
||||||
{{name.id}}!.tap do |value|
|
{{name.id}}!.tap do |value|
|
||||||
@_%proxy = TypedValueProxy(typeof({{name.id}}!)).new(value)
|
@_%wrapper = TypedValueWrapper(typeof({{name.id}}!)).new(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require "./value_proxy"
|
require "./value_wrapper"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
class TypedValueProxy(T) < ValueProxy
|
class TypedValueWrapper(T) < ValueWrapper
|
||||||
getter value : T
|
getter value : T
|
||||||
|
|
||||||
def initialize(@value : T)
|
def initialize(@value : T)
|
|
@ -2,7 +2,7 @@ module Spectator
|
||||||
# Base class for proxying test values to examples.
|
# Base class for proxying test values to examples.
|
||||||
# This abstraction is required for inferring types.
|
# This abstraction is required for inferring types.
|
||||||
# The `DSL#let` macro makes heavy use of this.
|
# The `DSL#let` macro makes heavy use of this.
|
||||||
private abstract class ValueProxy
|
private abstract class ValueWrapper
|
||||||
# Retrieves the underlying value.
|
# Retrieves the underlying value.
|
||||||
abstract def value
|
abstract def value
|
||||||
end
|
end
|
Loading…
Add table
Add a link
Reference in a new issue