Feature #4742

Allow for File.open('yo', :mode => File::WRONLY|File::TRUNC|File::CREAT)

Added by Roger Pack almost 3 years ago. Updated almost 3 years ago.

[ruby-core:36338]
Status:Closed
Priority:Normal
Assignee:Motohiro KOSAKI
Category:core
Target version:1.9.3

Description

Currently we have these options for File.open:

File.open('yo', 'w')
File.open('yo', File::WRONLY|File::TRUNC|File::CREAT)
File.open('yo', :mode => 'w')

but not
File.open('yo', :mode => File::WRONLY|File::TRUNC|File::CREAT)

Which seemed a bit surprising to me, so making a feature request for it.
Cheers!
-roger-

Associated revisions

Revision 31671
Added by Motohiro KOSAKI almost 3 years ago

  • io.c (rbioextract_modeenc): accept combination hash and File::Constants. (eg. File.open('yo', :mode => File::WRONLY)) [Feature #4742]
  • test/ruby/testio.rb (TestIO#testopen_mode): new test.

History

#1 Updated by Nobuyoshi Nakada almost 3 years ago

  • Tracker changed from Bug to Feature

#2 Updated by Motohiro KOSAKI almost 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r31671.
Roger, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • io.c (rbioextract_modeenc): accept combination hash and File::Constants. (eg. File.open('yo', :mode => File::WRONLY)) [Feature #4742]
  • test/ruby/testio.rb (TestIO#testopen_mode): new test.

#3 Updated by Motohiro KOSAKI almost 3 years ago

  • Category set to core
  • Assignee set to Motohiro KOSAKI
  • Target version set to 1.9.3

Also available in: Atom PDF