How about we simplify this with just send("to_#{ext}") and modify to use file extensions vs. hash in const. %w(xml json)