mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix memoized subject from context description another way
The other method gave a strange compiler error when running specs. Something to do with "K" not having an inspect method. In /usr/share/crystal/src/hash.cr:1826:13 1826 | key.inspect(io) ^------ Error: undefined method 'inspect' for K
This commit is contained in:
parent
86c8d6549a
commit
3aaab0e74f
1 changed files with 1 additions and 11 deletions
|
@ -24,17 +24,7 @@ module Spectator
|
||||||
{{what}}
|
{{what}}
|
||||||
end
|
end
|
||||||
|
|
||||||
@%wrapper : ::Spectator::TypedValueWrapper({{what}})?
|
subject { described_class.new }
|
||||||
|
|
||||||
def subject(*args)
|
|
||||||
if (wrapper = @%wrapper)
|
|
||||||
wrapper.value
|
|
||||||
else
|
|
||||||
described_class.new(*args).tap do |value|
|
|
||||||
@%wrapper = ::Spectator::TypedValueWrapper.new(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
{% else %}
|
{% else %}
|
||||||
def _spectator_implicit_subject(*args)
|
def _spectator_implicit_subject(*args)
|
||||||
{{what}}
|
{{what}}
|
||||||
|
|
Loading…
Reference in a new issue