def render(scope, locals, &block)
reset_options!
@_locals, @_scope = locals, scope
self.copy_instance_variables_from(@_scope, [:@assigns, :@helpers])
@_options[:scope] = @_scope
@_options[:format] ||= self.request_format
@_data = locals[:object] || self.default_object
if @_options[:source_location]
instance_eval(@_source, @_options[:source_location]) if @_source.present?
else
instance_eval(@_source) if @_source.present?
end
instance_eval(&block) if block_given?
cache_results { self.send("to_" + @_options[:format].to_s) }
end