Issue #11638 has been updated by takanabe (Takayuki Watanabe).


Yes. When we use appending mode without offset, the file is not  truncated. 
Truncating files are occurred in write mode only. So it seems that we should just add the behaviour in write mode rather than adding behaviour in append mode.

I created PR for this ticket on github: https://github.com/ruby/ruby/pull/1571

----------------------------------------
Bug #11638: [doc] misleading IO.write offset description
https://bugs.ruby-lang.org/issues/11638#change-63970

* Author: akostadinov (Aleksandar Kostadinov)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
"If offset is not given, the file is truncated. Otherwise, it is not truncated."

The above is NOT true when 'a' mode is used. I'd suggest to clarify in documentation that offset is usually 0 if not specified but in 'a' mode it is at end of file or something along these lines.

http://ruby-doc.org/core-2.2.0/IO.html#method-c-write



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>