1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/pathname/pathname.c (path_opendir): Pathname#opendir translated

from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-09-16 14:48:20 +00:00
parent 5c1fd225c8
commit 08c467330b
3 changed files with 18 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Sep 16 23:47:59 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_opendir): Pathname#opendir translated
from pathname.rb.
Thu Sep 16 21:40:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Sep 16 21:40:37 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb (Test::Unit::GlobOption): merged RejectOption. * lib/test/unit.rb (Test::Unit::GlobOption): merged RejectOption.

View file

@ -494,10 +494,6 @@ class Pathname # * Dir *
Dir.foreach(@path) {|f| yield self.class.new(f) } Dir.foreach(@path) {|f| yield self.class.new(f) }
end end
# See <tt>Dir.open</tt>.
def opendir(&block) # :yield: dir
Dir.open(@path, &block)
end
end end

View file

@ -904,6 +904,18 @@ path_rmdir(VALUE self)
return rb_funcall(rb_cDir, rb_intern("rmdir"), 1, get_strpath(self)); return rb_funcall(rb_cDir, rb_intern("rmdir"), 1, get_strpath(self));
} }
/*
* See <tt>Dir.open</tt>.
*/
static VALUE
path_opendir(VALUE self)
{
VALUE args[1];
args[0] = get_strpath(self);
return rb_block_call(rb_cDir, rb_intern("open"), 1, args, 0, 0);
}
/* /*
* == Pathname * == Pathname
* *
@ -1163,4 +1175,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "entries", path_entries, 0); rb_define_method(rb_cPathname, "entries", path_entries, 0);
rb_define_method(rb_cPathname, "mkdir", path_mkdir, -1); rb_define_method(rb_cPathname, "mkdir", path_mkdir, -1);
rb_define_method(rb_cPathname, "rmdir", path_rmdir, 0); rb_define_method(rb_cPathname, "rmdir", path_rmdir, 0);
rb_define_method(rb_cPathname, "opendir", path_opendir, 0);
} }