aboutsummaryrefslogtreecommitdiff
path: root/src/guff/template.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/template.cr')
-rw-r--r--src/guff/template.cr10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/guff/template.cr b/src/guff/template.cr
index 01a4c86..4b54fb6 100644
--- a/src/guff/template.cr
+++ b/src/guff/template.cr
@@ -10,14 +10,16 @@ module Guff
def run(args = nil : Hash(String, String)?) : String
if @has_keys
# check template args
- if args || args.size == 0
- raise "missing template args: %s" % [@tokens.select { |t|
+ if !args || args.size == 0
+ raise "missing template args: %s" % [@tokens.select { |t|
t.type == :key
- }.join(", ")]
+ }.map { |t|
+ t.value
+ }.sort.join(", ")]
end
# build result
- String.builder do |r|
+ String.build do |r|
@tokens.each do |t|
r << t.get(args)
end