Delegates 3 arguments for Pathname.glob.
Thanks for the patch by pocke (Masataka Kuwabara) [Feature #14405].
This commit is contained in:
parent
61577fa53b
commit
4d9504fe13
@ -1092,10 +1092,10 @@ s_glob_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
|
|||||||
static VALUE
|
static VALUE
|
||||||
path_s_glob(int argc, VALUE *argv, VALUE klass)
|
path_s_glob(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
VALUE args[2];
|
VALUE args[3];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = rb_scan_args(argc, argv, "11", &args[0], &args[1]);
|
n = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2]);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
return rb_block_call(rb_cDir, id_glob, n, args, s_glob_i, klass);
|
return rb_block_call(rb_cDir, id_glob, n, args, s_glob_i, klass);
|
||||||
}
|
}
|
||||||
|
@ -1251,6 +1251,17 @@ class TestPathname < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_s_glob_3args
|
||||||
|
with_tmpchdir('rubytest-pathname') {|dir|
|
||||||
|
open("f", "w") {|f| f.write "abc" }
|
||||||
|
Dir.chdir("/") {
|
||||||
|
assert_equal(
|
||||||
|
[Pathname("."), Pathname(".."), Pathname("f")],
|
||||||
|
Pathname.glob("*", File::FNM_DOTMATCH, base: dir).sort)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def test_s_getwd
|
def test_s_getwd
|
||||||
wd = Pathname.getwd
|
wd = Pathname.getwd
|
||||||
assert_kind_of(Pathname, wd)
|
assert_kind_of(Pathname, wd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user