mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Change described_class
to a macro
This commit is contained in:
parent
46875d7770
commit
e66c0abcfb
1 changed files with 2 additions and 6 deletions
|
@ -258,12 +258,8 @@ module Spectator::DSL
|
||||||
# Need to investigate, but would also increase minimum version.
|
# Need to investigate, but would also increase minimum version.
|
||||||
{% if what.is_a?(Path) || what.is_a?(Generic) %}
|
{% if what.is_a?(Path) || what.is_a?(Generic) %}
|
||||||
# Returns the type currently being described.
|
# Returns the type currently being described.
|
||||||
def described_class
|
macro described_class
|
||||||
{{what}}.tap do |thing|
|
{{what}}
|
||||||
# Runtime check to ensure that `what` is a type.
|
|
||||||
raise "#{thing} must be a type name to use #described_class or #subject,\
|
|
||||||
but it is a #{typeof(thing)}" unless thing.is_a?(Class)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Implicit subject definition.
|
# Implicit subject definition.
|
||||||
|
|
Loading…
Reference in a new issue