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 def self.\%tags
tags = _spectator_tags tags = _spectator_tags
\{% if !tags.empty? %} \{% if !tags.empty? %}
tags.concat({ \{{tags.map(&.id.stringify).splat}} }) tags.concat({ \{{tags.map(&.id.symbolize).splat}} })
\{% end %} \{% end %}
\{% for k, v in metadata %} \{% for k, v in metadata %}
cond = begin cond = begin
\{{v}} \{{v}}
end end
if cond if cond
tags.add(\{{k.id.stringify}}) tags.add(\{{k.id.symbolize}})
else else
tags.delete(\{{k.id.stringify}}) tags.delete(\{{k.id.symbolize}})
end end
\{% end %} \{% end %}
tags tags

View file

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

View file

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