aboutsummaryrefslogtreecommitdiff
path: root/src/guff/template-token.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/template-token.cr')
-rw-r--r--src/guff/template-token.cr21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/guff/template-token.cr b/src/guff/template-token.cr
new file mode 100644
index 0000000..04e8f11
--- /dev/null
+++ b/src/guff/template-token.cr
@@ -0,0 +1,21 @@
+module Guff
+ class TemplateToken
+ getter :type
+
+ def initialize(@type : Symbol, @val : String)
+ end
+
+ def get(args : Hash(String, String))
+ case @type
+ when :key
+ raise "missing key: #{@val}" unless args.has_key?(@val)
+ args[@val]
+ when :val
+ @val
+ else
+ # never reached
+ raise "unknown token type: #{@type}"
+ end
+ end
+ end
+end