5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/zena/use/zafu_eval.rb', line 5
def zafu_eval(node, code, opts)
if opts[:template]
master_template = secure(Node) { Node.find_by_zip(opts[:template]) }
end
path = opts[:zafu_url]
parser = ::Zena::ZafuCompiler.new(code,
:helper => self,
:base_path => path,
:included_history => [path],
:root => path,
:master_template => master_template
)
_node = node
node_context = Zena::Use::NodeContext.new('_node', node.vclass)
erb = parser.to_erb(
:dev => false,
:node => node_context,
:master_template => master_template
)
ERB.new(erb).result(binding)
rescue => err
err.message
end
|