Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from May 2, 2015
Merged

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 lumeet commented Mar 25, 2015

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

@lumeet lumeet force-pushed the lumeet:pathname_open branch from e22d1da to a4e00cf Mar 26, 2015
@enebo
Copy link
Member

@enebo 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 lumeet force-pushed the lumeet:pathname_open branch from a4e00cf to 39e20df May 2, 2015
@lumeet
Copy link
Contributor Author

@lumeet 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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lumeet lumeet deleted the lumeet:pathname_open branch May 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants