Module RIO::IF::File lib/rio/if/file.rb   

Methods

clear   rm   touch   truncate  

Public Instance methods

Calls FileUtils#rm

Deletes the referenced file, returning the Rio. Raises an exception on any error.

See also delete, delete!, rmdir.

Calls FileUtils#touch

Updates modification time (mtime) and access time (atime) of a Rio. A file is created if it doesn’t exist.

Calls File#truncate

Truncates a file referenced by a Rio to be at most sz bytes long. Not available on all platforms.

 f = rio("out")
 f.print!("1234567890")
 f.size                     #=> 10
 f.truncate(5)
 f.size()                   #=> 5

If called with no arguments, truncates the Rio at the value returned by pos().

 f.read(2)
 f.truncate.size            #=> 2
 f.contents                 #=> "12"

Returns the Rio

Copyright © 2005,2006,2007 Christopher Kleckner. All rights reserved.