Skip to content

Allow File.open and File.new with 4 arguments#2756

Merged
enebo merged 1 commit intojruby:masterfrom
lumeet:pathname_open
May 2, 2015
Merged

Allow File.open and File.new with 4 arguments#2756
enebo merged 1 commit intojruby:masterfrom
lumeet:pathname_open

Conversation

@lumeet
Copy link
Contributor

@lumeet lumeet commented Mar 25, 2015

The methods now support filename, mode, permissions and options as
separate parameters.

The actual logic seems to be there already. For example, the following now has the same behavior as MRI 1.9+.

File.open('test', 'w', 0777, cr_newline: true) { |f| f.puts 'test' }

@lumeet
Copy link
Contributor Author

lumeet commented Mar 25, 2015

Ok, not quite then. I'll take a look at it again.

@enebo
Copy link
Member

enebo commented May 1, 2015

@lumeet This removed convertToHash which will try and call to_hash if it is not an explicit Ruby Hash. I think perhaps tests are working but I think this will now break:

class Foo; def to_hash; {cr_newline: true }; end; end
File.open('test', 'w', 0777, Foo.new) { |f| f.puts 'test' }

The methods now support filename, mode, permissions and options as
separate parameters.
@lumeet
Copy link
Contributor Author

lumeet commented May 2, 2015

@enebo It should be better now. Hopefully I haven't forgotten anything.

@enebo enebo added this to the JRuby 9.0.0.0.rc1 milestone May 2, 2015
enebo added a commit that referenced this pull request May 2, 2015
Allow File.open and File.new with 4 arguments
@enebo enebo merged commit 752d093 into jruby:master May 2, 2015
@lumeet lumeet deleted the pathname_open branch May 2, 2015 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants