xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do xml.channel do @rss_options.each {|key, value| instance_eval("xml.#{key}(value)") } for item in @rss_items xml.item do [:title, :description, :pubDate, :guid, :link].each do |meth| value, full_meth = nil, "#{meth}_for_rss" if item.respond_to? full_meth value = item.method(full_meth).arity == 1 ? item.send(full_meth, controller) : item.send(full_meth) end instance_eval("xml.#{meth}(value)") if value end end end end end