lib/rufus/verbs.rb in rufus-verbs-0.8 vs lib/rufus/verbs.rb in rufus-verbs-0.9

- old
+ new

@@ -94,10 +94,12 @@ # It is not named open() in order not to collide with File.open and # open-uri's open. # def fopen (uri, *args, &block) + # should I really care about blocks here ? ... + u = URI.parse uri.to_s return File.open(uri.to_s, &block) \ if u.scheme == nil @@ -109,12 +111,18 @@ r = EndPoint.request(:get, [ uri ] + args) \ if block block.call r return - else - return r end + + class << r + def read + self.body + end + end unless r.respond_to?(:read) + + return r end raise "can't handle scheme '#{u.scheme}' for #{u.to_s}" end