Sha256: 53cd807b8aa300ee99ee6dc7b09d59f465049e7c929f0c4e9ad56b3e26024738
Contents?: true
Size: 435 Bytes
Versions: 64
Compression:
Stored size: 435 Bytes
Contents
# takes a filename or an io object, hands a rewinded io object to the # reciever and then closes the file or places the io in the original # position. def openany(arg, &block) io = if arg.is_a?(String) # filename File.open(arg) else orig_pos = arg.pos arg.rewind arg end reply = block.call(io) if arg.is_a?(String) # filename io.close else arg.pos = orig_pos end reply end
Version data entries
64 entries across 64 versions & 2 rubygems