mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move conditional into context macro
This commit is contained in:
parent
fe81341e1a
commit
d679c356fd
1 changed files with 9 additions and 9 deletions
|
@ -18,7 +18,9 @@ module Spectator
|
||||||
::Spectator::Definitions::GROUPS[{{@type.stringify}}]
|
::Spectator::Definitions::GROUPS[{{@type.stringify}}]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
{% if what.is_a?(Path) || what.is_a?(Generic) %}
|
||||||
_described_class {{what}}
|
_described_class {{what}}
|
||||||
|
{% end %}
|
||||||
|
|
||||||
{{block.body}}
|
{{block.body}}
|
||||||
end
|
end
|
||||||
|
@ -121,7 +123,6 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
macro _described_class(what)
|
macro _described_class(what)
|
||||||
{% if what.is_a?(Path) || what.is_a?(Generic) %}
|
|
||||||
def described_class
|
def described_class
|
||||||
{{what}}.tap do |thing|
|
{{what}}.tap do |thing|
|
||||||
raise "#{thing} must be a type name to use #described_class or #subject,\
|
raise "#{thing} must be a type name to use #described_class or #subject,\
|
||||||
|
@ -130,7 +131,6 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
_implicit_subject
|
_implicit_subject
|
||||||
{% end %}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
macro _implicit_subject
|
macro _implicit_subject
|
||||||
|
|
Loading…
Reference in a new issue