lib/musterb/template_handler.rb in musterb-0.1.0 vs lib/musterb/template_handler.rb in musterb-0.1.1

- old
+ new

@@ -13,16 +13,15 @@ def text_with_escaping(tokens) "<%= #{tokens} %>" end def self.compile_mustache(source, options = {}) - erb = Musterb.to_erb(source, options.merge(:musterbifier_klass => self)) + initial_context = options[:start_with_existing_context] ? "initial_context" : 'Musterb::InstanceVariableExtractor.new(self, Musterb::BindingExtractor.new(binding))' + erb = Musterb.to_erb(source, options.merge(:musterbifier_klass => self, :initial_context => initial_context)) klass = ActionView::Template::Handlers::ERB klass.erb_implementation.new(erb, :trim => (klass.erb_trim_mode == "-")).src end def self.call(template) - options = {} - options[:initial_context] = "initial_context" if template.locals.include? "initial_context" - compile_mustache(template.source, options) + compile_mustache(template.source, :start_with_existing_context => template.locals.include?("initial_context")) end end \ No newline at end of file