1
0

Fix Slim, add Tenjin - new winner!

This commit is contained in:
2013-12-15 01:32:31 +07:00
parent e24c040f01
commit 4a8e148fc6
11 changed files with 143 additions and 60 deletions
+7 -5
View File
@@ -1,9 +1,11 @@
module Wrappers
class Base
attr_reader :tpl
module Workbench
module Wrappers
class Base
attr_reader :tpl
def initialize path
@tpl = File.read(path)
def initialize path
@tpl = File.read(path)
end
end
end
end
+6 -4
View File
@@ -1,7 +1,9 @@
module Wrappers
class Mustache < Base
def render context, args = {}
::Mustache.render(tpl, args)
module Workbench
module Wrappers
class Mustache < Base
def render context, args = {}
::Mustache.render(tpl, args)
end
end
end
end
+13
View File
@@ -0,0 +1,13 @@
module Workbench
module Wrappers
class Slim < Base
def initialize path
@engine = ::Slim::Template.new{ File.read(path) }
end
def render context, args = {}
@engine.render(OpenStruct.new(args))
end
end
end
end
+14
View File
@@ -0,0 +1,14 @@
module Workbench
module Wrappers
class Tenjin < Base
def initialize path
@path = path
@engine = ::Tenjin::Engine.new
end
def render context, args = {}
@engine.render(@path, args)
end
end
end
end