Method Missing?

Builder is a completely declarative library which makes it easy to generate XML from a cascade of Ruby method calls. But it's not completely smooth sending: working on an Atom feed, I ran into a small issue with the method_missing style of freeform XML tagging:

atom.entry do
  atom.id entry_id
end

This generates the tag, but with incorrect data and Ruby coughs up an error: warning: Object#id will be deprecated; use Object#object_id. Not cool. Apart from the obvious step of switching off warnings, the solution is rather simple, though it breaks the pure syntax:

atom.entry do
  atom.tag! :id, entry_id
end

Food for thought in terms of the limitations of being able to freely send any named message to an object. Writing APIs to Wrap APIs has some useful comments on this particular scenario, giving an example of why it is often a good idea to write concrete wrapper code.