Fix DSL usage of tags

Ensure parent tags don't get modified by duplicating the hash.
Force tag value to string.
This commit is contained in:
Michael Miller 2021-06-11 20:22:08 -06:00
parent dcdc64e134
commit 117ed90185
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -5,7 +5,7 @@ module Spectator::DSL
# Any falsey items from *metadata* are removed. # Any falsey items from *metadata* are removed.
private macro _spectator_tags(name, source, *tags, **metadata) private macro _spectator_tags(name, source, *tags, **metadata)
private def self.{{name.id}} private def self.{{name.id}}
%tags = {{source.id}} %tags = {{source.id}}.dup
{% for k in tags %} {% for k in tags %}
%tags[{{k.id.symbolize}}] = nil %tags[{{k.id.symbolize}}] = nil
{% end %} {% end %}
@ -14,7 +14,7 @@ module Spectator::DSL
{{v}} {{v}}
end end
if %cond if %cond
%tags[{{k.id.symbolize}}] = %cond %tags[{{k.id.symbolize}}] = %cond.to_s
else else
%tags.delete({{k.id.symbolize}}) %tags.delete({{k.id.symbolize}})
end end