def display(object, thing = nil, opts = {})
template_opt = opts.delete(:template)
case thing
when String
template_opt, thing = thing, nil
when Hash
opts, thing = thing, nil
end
render(thing || action_name.to_sym, opts.merge(:template => template_opt))
rescue TemplateNotFound
opts = self.class.default_render_options.merge(opts)
transform = Merb.mime_transform_method(content_type)
raise NotAcceptable unless transform && object.respond_to?(transform)
layout_opt = opts.delete(:layout)
if layout_opt
template = _template_location(layout_opt, layout.index(".") ? content_type : nil, "layout")
layout = _template_for(_template_root / template) ||
(raise TemplateNotFound, "No layout found at #{_template_root / template}.*")
send(layout)
else
unless opts.empty?
throw_content(:for_layout, object.send(transform, opts))
else
throw_content(:for_layout, object.send(transform))
end
catch_content(:for_layout)
end
end