ruby-changes:17276
From: akr <ko1@a...>
Date: Thu, 16 Sep 2010 23:51:26 +0900 (JST)
Subject: [ruby-changes:17276] Ruby:r29277 (trunk): * ext/pathname/pathname.c (path_opendir): Pathname#opendir translated
akr 2010-09-16 23:48:20 +0900 (Thu, 16 Sep 2010) New Revision: 29277 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29277 Log: * ext/pathname/pathname.c (path_opendir): Pathname#opendir translated from pathname.rb. Modified files: trunk/ChangeLog trunk/ext/pathname/lib/pathname.rb trunk/ext/pathname/pathname.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29276) +++ ChangeLog (revision 29277) @@ -1,3 +1,8 @@ +Thu Sep 16 23:47:59 2010 Tanaka Akira <akr@f...> + + * ext/pathname/pathname.c (path_opendir): Pathname#opendir translated + from pathname.rb. + Thu Sep 16 21:40:37 2010 Nobuyoshi Nakada <nobu@r...> * lib/test/unit.rb (Test::Unit::GlobOption): merged RejectOption. Index: ext/pathname/lib/pathname.rb =================================================================== --- ext/pathname/lib/pathname.rb (revision 29276) +++ ext/pathname/lib/pathname.rb (revision 29277) @@ -494,10 +494,6 @@ Dir.foreach(@path) {|f| yield self.class.new(f) } end - # See <tt>Dir.open</tt>. - def opendir(&block) # :yield: dir - Dir.open(@path, &block) - end end Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 29276) +++ ext/pathname/pathname.c (revision 29277) @@ -905,6 +905,18 @@ } /* + * 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 represents a pathname which locates a file in a filesystem. @@ -1163,4 +1175,5 @@ 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); + rb_define_method(rb_cPathname, "opendir", path_opendir, 0); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/