intertwingly

It’s just data

Quack Squared


In response to this, a suggestion:

uri = AtomURI.check alleged_uri
return report_error(uri) unless uri.methods.include? :path

request = Net::HTTP::Get.new(uri.path)

First, I believe that it is important that the error recovery impacts the flow of meaningful text to the least extent possible.  The original version might as well have used exceptions.

Second, and in the spirit of duck typing, consider checking for a required behavior or characteristic instead of checking on the class of an object.  The above code is superior to the original in that it can handle the possibility of non-string messages.