lib/express_templates/renderer.rb in express_templates-0.2.0 vs lib/express_templates/renderer.rb in express_templates-0.2.2

- old
+ new

@@ -1,16 +1,11 @@ module ExpressTemplates module Renderer # render accepts source or block, expands to macros # compiles the resulting macros # and then evaluates the resulting string of ruby in the context provided - def render context=nil, template_source=nil, &block - expander = ExpressTemplates::Expander.new(nil) - expanded_template = if block - (expander.expand(&block).map(&:compile).join(';')) - else - expander.expand(template_source).map(&:compile).join(";") - end - context.instance_eval expanded_template + def render context=nil, template_or_src=nil, &block + compiled_template = compile(template_or_src, &block) + context.instance_eval compiled_template end end end \ No newline at end of file