Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2f35b4023f74
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 752d093b49d3
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on May 2, 2015

  1. Allow File.open and File.new with 4 arguments

    The methods now support filename, mode, permissions and options as
    separate parameters.
    lumeet committed May 2, 2015
    Copy the full SHA
    39e20df View commit details
  2. Merge pull request #2756 from lumeet/pathname_open

    Allow File.open and File.new with 4 arguments
    enebo committed May 2, 2015
    Copy the full SHA
    752d093 View commit details
Showing with 7 additions and 3 deletions.
  1. +7 −2 core/src/main/java/org/jruby/RubyFile.java
  2. +0 −1 test/mri/excludes/TestPathname.rb
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
@@ -321,7 +321,7 @@ public IRubyObject flock(ThreadContext context, IRubyObject operation) {
}

// rb_file_initialize
@JRubyMethod(name = "initialize", required = 1, optional = 2, visibility = PRIVATE)
@JRubyMethod(name = "initialize", required = 1, optional = 3, visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block) {
if (openFile != null) {
throw context.runtime.newRuntimeError("reinitializing File");
@@ -1225,7 +1225,12 @@ protected IRubyObject openFile(ThreadContext context, IRubyObject args[]) {
break;
}
case 4:
options = args[3].convertToHash();
if (!args[3].isNil()) {
options = TypeConverter.convertToTypeWithCheck(args[3], context.runtime.getHash(), "to_hash");
if (options.isNil()) {
throw runtime.newArgumentError("wrong number of arguments (4 for 1..3)");
}
}
vperm(pm, args[2]);
vmode(pm, args[1]);
break;
1 change: 0 additions & 1 deletion test/mri/excludes/TestPathname.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
exclude :test_find, "fails to EACCES an unreadable path, root cause of test_find.rb's test_unreadable_dir failure?"
exclude :test_lchmod, "fails on Travis, maybe on Linux in general?"
exclude :test_open, "4-args open()"
exclude :test_realdirpath, "bad symlink resolution"
exclude :test_realpath, "needs investigation"
exclude :test_relative_path_from_casefold, "path encoding problems"