diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-03-06 19:17:22 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-03-06 19:17:22 -0500 |
commit | 884afe538a5de60fd5638a87620d3cfa00d90f6f (patch) | |
tree | c3365f627419d0081452a308b9d1cfe7f8b09e93 /src/guff/template-cache.cr | |
parent | e7e975568d596810b74e207e73426624c215bb24 (diff) | |
download | old-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.cr | 12 |
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 |