module MogileFS::NewFile::Writer
All objects yielded or returned by MogileFS::MogileFS#new_file
should conform to this interface (based on existing IO methods). These objects should be considered write-only.
Public Instance Methods
<<(str)
click to toggle source
see IO#<<
# File lib/mogilefs/new_file/writer.rb, line 41 def <<(str) write(str) self end
close()
click to toggle source
This will issue the create_close
command to the MogileFS
tracker and finalize the creation of a new file. This returns nil
on success and will raise IOError if called twice. For non-streaming implementations, this will initiate and finalize the upload.
see IO#close
# File lib/mogilefs/new_file/writer.rb, line 52 def close commit nil end
print(*args)
click to toggle source
see IO#print
# File lib/mogilefs/new_file/writer.rb, line 23 def print(*args) args = [ $_ ] unless args[0] write(args.shift) args.each do |obj| write(obj) write($,) if $, end write($\) if $\ nil end
printf(*args)
click to toggle source
see IO#printf
# File lib/mogilefs/new_file/writer.rb, line 35 def printf(*args) write(sprintf(*args)) nil end
putc(ch)
click to toggle source
see IO#putc
# File lib/mogilefs/new_file/writer.rb, line 17 def putc(ch) write(ch.respond_to?(:chr) ? ch.chr : ch[0]) ch end
puts(*args)
click to toggle source
see IO#puts
# File lib/mogilefs/new_file/writer.rb, line 8 def puts(*args) args.each do |obj| write(obj) write("\n".freeze) end nil end