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