diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-03 02:14:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-03 02:14:51 +0000 |
commit | 83a31e9e90b978d73cbcfa4c1b5e936bb395bafe (patch) | |
tree | 6333fe4b82ca513d3c33aebf183aec5086b5cef0 /dir.c | |
parent | 432e6805e1b14bc374724ab9fd03559811b871fb (diff) |
dir.c: relax base option
* dir.c (dir_glob_options): relax base option. ignore when nil
or an empty string as :base option. [Feature #13056]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2466,7 +2466,7 @@ dir_glob_options(VALUE opt, VALUE *base, int *flags) kw[0] = rb_intern("base"); if (flags) kw[1] = rb_intern("flags"); rb_get_kwargs(opt, kw, 0, flags ? 2 : 1, args); - if (args[0] == Qundef) { + if (args[0] == Qundef || NIL_P(args[0])) { *base = Qnil; } #if USE_OPENDIR_AT @@ -2476,6 +2476,7 @@ dir_glob_options(VALUE opt, VALUE *base, int *flags) #endif else { GlobPathValue(args[0], TRUE); + if (!RSTRING_LEN(args[0])) args[0] = Qnil; *base = args[0]; } if (flags && args[1] != Qundef) { |