aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-07-25 21:46:07 -0400
committerPaul Duncan <pabs@pablotron.org>2016-07-25 21:46:07 -0400
commitc2a20d2fdef43cf2967919295ba7cf6ecffe57fc (patch)
tree21ac865a00d6ed09fa7e335b8f11c69b27f1ada5
parentdc4de99af4e14ebdd384941e699cbbaacd3636d4 (diff)
downloadguff-c2a20d2fdef43cf2967919295ba7cf6ecffe57fc.tar.bz2
guff-c2a20d2fdef43cf2967919295ba7cf6ecffe57fc.zip
add Template#run(io, args)
-rw-r--r--src/guff/template.cr10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/guff/template.cr b/src/guff/template.cr
index 3068669..c784a90 100644
--- a/src/guff/template.cr
+++ b/src/guff/template.cr
@@ -130,11 +130,15 @@ class Guff::Template
@ops = parse(@string) as Array(Ops::Op)
end
+ def run(io : IO, args : Hash(String, String))
+ @ops.each do |op|
+ io << op.run(args)
+ end
+ end
+
def run(args : Hash(String, String))
String.build do |io|
- @ops.each do |op|
- io << op.run(args)
- end
+ run(io, args)
end
end