I would suggest wrapping the library with your own class, adding the functionality there. This has the added benefit of keeping the logic all in one place, and letting you customize the functionality to fit your domain better.
Perhaps something along these lines:
class MySuperRadImageList
def self.open(path)
image_list = if URI(path).host.nil?
Magick::ImageList.new(path)
else
Magick::ImageList.new.from_blob(open(path).read)
end
self.new(image_list)
end
def initialize(image_list)
# ...
end
end
I would recommend refactoring the above code, but wanted to show you an concrete example of what I was suggesting (especially that line in the else
clause o.O ).