summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--ext/pathname/pathname.c55
-rw-r--r--test/pathname/test_pathname.rb13
3 files changed, 70 insertions, 2 deletions
@@ -150,6 +150,10 @@ with all sufficient information, see the ChangeLog file or Redmine
environment variable if the system's environment variable is multiuser
safe. [Bug #12921]
* RbConfig
* New constants:
* RbConfig::LIMITS is added to provide the limits of C types.
@@ -3,6 +3,7 @@
static VALUE rb_cPathname;
static ID id_at_path, id_to_path;
static ID id_ENOTDIR, id_atime, id_basename, id_binread, id_binwrite,
id_birthtime, id_blockdev_p, id_chardev_p, id_chmod, id_chown,
id_ctime, id_directory_p, id_dirname, id_empty_p, id_entries,
@@ -1021,7 +1022,7 @@ path_empty_p(VALUE self)
}
static VALUE
-glob_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
{
return rb_yield(rb_class_new_instance(1, &elt, klass));
}
@@ -1042,7 +1043,7 @@ path_s_glob(int argc, VALUE *argv, VALUE klass)
n = rb_scan_args(argc, argv, "11", &args[0], &args[1]);
if (rb_block_given_p()) {
- return rb_block_call(rb_cDir, id_glob, n, args, glob_i, klass);
}
else {
VALUE ary;
@@ -1058,6 +1059,54 @@ path_s_glob(int argc, VALUE *argv, VALUE klass)
}
}
/*
* Returns the current working directory as a Pathname.
*
@@ -1485,6 +1534,7 @@ Init_pathname(void)
rb_define_singleton_method(rb_cPathname, "glob", path_s_glob, -1);
rb_define_singleton_method(rb_cPathname, "getwd", path_s_getwd, 0);
rb_define_singleton_method(rb_cPathname, "pwd", path_s_getwd, 0);
rb_define_method(rb_cPathname, "entries", path_entries, 0);
rb_define_method(rb_cPathname, "mkdir", path_mkdir, -1);
rb_define_method(rb_cPathname, "rmdir", path_rmdir, 0);
@@ -1505,6 +1555,7 @@ InitVM_pathname(void)
id_ENOTDIR = rb_intern("ENOTDIR");
id_atime = rb_intern("atime");
id_basename = rb_intern("basename");
id_binread = rb_intern("binread");
id_binwrite = rb_intern("binwrite");
id_birthtime = rb_intern("birthtime");
@@ -1250,6 +1250,19 @@ class TestPathname < Test::Unit::TestCase
assert_kind_of(Pathname, wd)
end
def test_entries
with_tmpchdir('rubytest-pathname') {|dir|
open("a", "w") {}