Change groups from metadata to tags

This commit is contained in:
Michael Miller 2021-01-30 11:21:49 -07:00
parent 71a497b148
commit e77d6f0a4f
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -16,16 +16,22 @@ module Spectator::DSL
class Group\%group < \{{@type.id}}
_spectator_group_subject(\{{what}})
def self._spectator_metadata
def self._spectator_tags
\{% if tags.empty? && metadata.empty? %}
super
\{% else %}
super.merge(
\{% for tag in tags %}
\{{tag.id.stringify}}: true,
super.concat({\{{tags.map(&.id.stringify).splat}}}).tap do |tags|
\{% for k, v in metadata %}
cond = begin
\{{v}}
end
if cond
tags.add(\{{k.id.stringify}})
else
tags.remove(\{{k.id.stringify}})
end
\{% end %}
\{{metadata.double_splat}}
)
end
\{% end %}
end