aboutsummaryrefslogtreecommitdiff
path: root/src/guff/template-cache.cr
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-06 19:17:22 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-06 19:17:22 -0500
commit884afe538a5de60fd5638a87620d3cfa00d90f6f (patch)
treec3365f627419d0081452a308b9d1cfe7f8b09e93 /src/guff/template-cache.cr
parente7e975568d596810b74e207e73426624c215bb24 (diff)
downloadold-guff-884afe538a5de60fd5638a87620d3cfa00d90f6f.tar.bz2
old-guff-884afe538a5de60fd5638a87620d3cfa00d90f6f.zip
add templates
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