1
0
This commit is contained in:
2013-12-15 03:42:15 +07:00
parent 9becb386fb
commit 47d5ab67a0
8 changed files with 90 additions and 3 deletions
+2
View File
@@ -14,6 +14,7 @@ require 'mustache'
require 'tenjin'
require 'handlebars'
# require 'parkaby'
require 'tagz'
require 'tilt/erb'
require 'tilt/erubis'
require 'tilt/haml'
@@ -26,3 +27,4 @@ require 'workbench/wrappers/slim'
require 'workbench/wrappers/tenjin'
require 'workbench/wrappers/handlebars'
require 'workbench/wrappers/parkaby'
require 'workbench/wrappers/tagz'
+31
View File
@@ -0,0 +1,31 @@
module Workbench
module Wrappers
class Tagz < Base
def initialize path
@tpl = File.read(path)
@context = Context.new
end
def render context, args = {}
@context.with_args(args).instance_eval(tpl)
end
class Context
include ::Tagz
def with_args args
@args = args
self
end
def method_missing method, *args
if @args.key?(method)
@args[method]
else
super
end
end
end
end
end
end