lib/musterb/template_handler.rb in musterb-1.0.0 vs lib/musterb/template_handler.rb in musterb-1.0.1

- old
+ new

@@ -13,18 +13,16 @@ def text_with_escaping(tokens) "<%= #{tokens} %>" end def self.build_initial_context(locals) + return "initial_context" if locals.include?("initial_context") + return "Musterb::ExtractValues.new_context(mustache)" if locals.include?("mustache") "Musterb::RailsLocalsExtractor.new(#{locals.inspect}, binding, Musterb::InstanceVariableExtractor.new(self, Musterb::NullExtractor.new))" end - def self.initial_context(initial_context) - Musterb::ExtractValues.new_context(initial_context) - end - def self.call(template) - initial_context = template.locals.include?("initial_context") ? "Musterb::TemplateHandler.initial_context(initial_context)" : build_initial_context(template.locals.map(&:to_s)) + initial_context = build_initial_context(template.locals.map(&:to_s)) erb = Musterb.to_erb(template.source, :musterbifier_klass => self, :initial_context => initial_context) klass = ActionView::Template::Handlers::ERB klass.erb_implementation.new(erb, :trim => (klass.erb_trim_mode == "-")).src end end