lib/faml/compiler.rb in faml-0.5.1 vs lib/faml/compiler.rb in faml-0.6.0

- old
+ new

@@ -20,10 +20,11 @@ autoclose: DEFAULT_AUTO_CLOSE_TAGS, format: :html, preserve: DEFAULT_PRESERVE_TAGS, use_html_safe: false, filename: nil, + extend_helpers: false, ) def initialize(*) super @text_compiler = TextCompiler.new @@ -76,12 +77,15 @@ raise "InternalError: Unknown AST node #{ast.class}: #{ast.inspect}" end end def compile_root(ast) - [:multi, [:code, "extend ::#{helper_module.name}"]].tap do |temple| - compile_children(ast, temple) + temple = [:multi] + if options[:extend_helpers] + temple << [:code, "extend ::#{helper_module.name}"] end + compile_children(ast, temple) + temple end def helper_module if options[:use_html_safe] RailsHelpers