Add intermediate TypedStub

This commit is contained in:
Michael Miller 2022-03-16 21:05:43 -06:00
parent dc74a741cf
commit 8e38d3b054
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2
2 changed files with 14 additions and 2 deletions

View file

@ -0,0 +1,12 @@
require "./stub"
module Spectator
# Abstract type of stub that identifies the type of value produced by a stub.
#
# *T* is the type produced by the stub.
# How the stub produces this value is up to subclasses.
abstract class TypedStub(T) < Stub
# Return value.
abstract def value : T
end
end

View file

@ -1,9 +1,9 @@
require "./arguments"
require "./stub"
require "./typed_stub"
module Spectator
# Stub that responds with a static value.
class ValueStub(T) < Stub
class ValueStub(T) < TypedStub(T)
# Return value.
getter value : T