./lib/jbuilder_template.rb in jbuilder-0.5.0 vs ./lib/jbuilder_template.rb in jbuilder-0.6.0

- old
+ new

@@ -1,37 +1,27 @@ class JbuilderTemplate < Jbuilder - def self.encode(context) - new(context)._tap { |jbuilder| yield jbuilder }.target! - end - def initialize(context, *args) @context = context super(*args) end def partial!(options, locals = {}) case options - when Hash + when ::Hash options[:locals] ||= {} options[:locals].merge!(:json => self) @context.render(options) else @context.render(options, locals.merge(:json => self)) end end - - private - def _new_instance - __class__.new(@context, @key_formatter) - end end class JbuilderHandler cattr_accessor :default_format self.default_format = Mime::JSON def self.call(template) - # this juggling is required to keep line numbers right in the error %{__already_defined = defined?(json); json||=JbuilderTemplate.new(self); #{template.source} json.target! unless __already_defined} end end