Change tags to symbols

This commit is contained in:
Michael Miller 2021-01-30 12:03:38 -07:00
parent 5166cd7778
commit db877da984
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
3 changed files with 7 additions and 7 deletions

View file

@ -29,16 +29,16 @@ module Spectator::DSL
def self.\%tags
tags = _spectator_tags
\{% if !tags.empty? %}
tags.concat({ \{{tags.map(&.id.stringify).splat}} })
tags.concat({ \{{tags.map(&.id.symbolize).splat}} })
\{% end %}
\{% for k, v in metadata %}
cond = begin
\{{v}}
end
if cond
tags.add(\{{k.id.stringify}})
tags.add(\{{k.id.symbolize}})
else
tags.delete(\{{k.id.stringify}})
tags.delete(\{{k.id.symbolize}})
end
\{% end %}
tags

View file

@ -20,16 +20,16 @@ module Spectator::DSL
def self._spectator_tags
tags = super
\{% if !tags.empty? %}
tags.concat({ \{{tags.map(&.id.stringify).splat}} })
tags.concat({ \{{tags.map(&.id.symbolize).splat}} })
\{% end %}
\{% for k, v in metadata %}
cond = begin
\{{v}}
end
if cond
tags.add(\{{k.id.stringify}})
tags.add(\{{k.id.symbolize}})
else
tags.delete(\{{k.id.stringify}})
tags.delete(\{{k.id.symbolize}})
end
\{% end %}
tags

View file

@ -8,7 +8,7 @@ module Spectator
# but can be anything that should be iterated over when running the spec.
abstract class Node
# User-defined keywords used for filtering and behavior modification.
alias Tags = Set(String)
alias Tags = Set(Symbol)
# Location of the node in source code.
getter! source : Source