Rename Proxy to Wrapper

This commit is contained in:
Michael Miller 2018-08-30 14:07:46 -06:00
parent a0fbc61244
commit 5eb5561e61
3 changed files with 7 additions and 7 deletions

View file

@ -52,14 +52,14 @@ module Spectator
let!({{name}}!) {{block}}
module Context
@_%proxy : ValueProxy?
@_%wrapper : ValueWrapper?
def {{name.id}}
if (proxy = @_%proxy)
proxy.as(TypedValueProxy(typeof({{name.id}}!))).value
if (wrapper = @_%wrapper)
wrapper.as(TypedValueWrapper(typeof({{name.id}}!))).value
else
{{name.id}}!.tap do |value|
@_%proxy = TypedValueProxy(typeof({{name.id}}!)).new(value)
@_%wrapper = TypedValueWrapper(typeof({{name.id}}!)).new(value)
end
end
end

View file

@ -1,7 +1,7 @@
require "./value_proxy"
require "./value_wrapper"
module Spectator
class TypedValueProxy(T) < ValueProxy
class TypedValueWrapper(T) < ValueWrapper
getter value : T
def initialize(@value : T)

View file

@ -2,7 +2,7 @@ module Spectator
# Base class for proxying test values to examples.
# This abstraction is required for inferring types.
# The `DSL#let` macro makes heavy use of this.
private abstract class ValueProxy
private abstract class ValueWrapper
# Retrieves the underlying value.
abstract def value
end