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