aboutsummaryrefslogtreecommitdiff
path: root/src/guff/template-cache.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/template-cache.cr')
-rw-r--r--src/guff/template-cache.cr12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/guff/template-cache.cr b/src/guff/template-cache.cr
new file mode 100644
index 0000000..7a20179
--- /dev/null
+++ b/src/guff/template-cache.cr
@@ -0,0 +1,12 @@
+module Guff
+ class TemplateCache
+ def initialize(@templates : Hash(Symbol, String))
+ @cache = {} of Symbol => Template
+ end
+
+ def [](key : Symbol) : Template
+ raise "unknown template: #{key}" unless @templates[key]?
+ @cache[key] ||= Template.new(@templates[key])
+ end
+ end
+end