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