Custom MIME type syntax


#1

Hello there,

I’m new here, and so may not have be aware of any previous discusion on
this particular topic, but the lack of results when googling has led me
to believe there has been none.

Currently, the custom MIME type sytax is as follows:

respond_to do |format|
format.xml do
# …
end

format.js do
  # ...
end

end

What I do not understand is why the following syntax should not be used
instead:

case format
when :xml
# …
when :js
# …
end

This would mean defining a #format method that returned the name of the
negotiated content type.

Thoughts?