Simplify get method

This commit is contained in:
Michael Miller 2021-01-09 16:57:23 -07:00
parent 3e4b77da77
commit 4108a6602d
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436

View file

@ -11,9 +11,9 @@ module Spectator
# On the first invocation of this method, it will yield.
# The block should return the value to store.
# Subsequent calls will return the same value and not yield.
def get(type : T.class, &block : -> T) : T forall T
def get(&block : -> T) : T forall T
wrapper = @lazy.get { Wrapper.new(yield) }
wrapper.get(type)
wrapper.get(T)
end
end
end