ruby-changes:16960
From: akr <ko1@a...>
Date: Wed, 11 Aug 2010 06:19:17 +0900 (JST)
Subject: [ruby-changes:16960] Ruby:r28956 (trunk): * ext/pathname/pathname.c (path_stat): Pathname#stat translated
akr 2010-08-11 06:19:01 +0900 (Wed, 11 Aug 2010) New Revision: 28956 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28956 Log: * ext/pathname/pathname.c (path_stat): Pathname#stat translated from pathname.rb. Modified files: trunk/ChangeLog trunk/ext/pathname/lib/pathname.rb trunk/ext/pathname/pathname.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28955) +++ ChangeLog (revision 28956) @@ -1,3 +1,8 @@ +Wed Aug 11 06:18:20 2010 Tanaka Akira <akr@f...> + + * ext/pathname/pathname.c (path_stat): Pathname#stat translated + from pathname.rb. + Tue Aug 10 21:18:04 2010 Tadayoshi Funaba <tadf@d...> * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact Index: ext/pathname/lib/pathname.rb =================================================================== --- ext/pathname/lib/pathname.rb (revision 28955) +++ ext/pathname/lib/pathname.rb (revision 28956) @@ -512,9 +512,6 @@ class Pathname # * File * - # See <tt>File.stat</tt>. Returns a <tt>File::Stat</tt> object. - def stat() File.stat(@path) end - # See <tt>File.lstat</tt>. def lstat() File.lstat(@path) end Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 28955) +++ ext/pathname/pathname.c (revision 28956) @@ -376,6 +376,15 @@ } /* + * See <tt>File.stat</tt>. Returns a <tt>File::Stat</tt> object. + */ +static VALUE +path_stat(VALUE self) +{ + return rb_funcall(rb_cFile, rb_intern("stat"), 1, get_strpath(self)); +} + +/* * == Pathname * * Pathname represents a pathname which locates a file in a filesystem. @@ -589,4 +598,5 @@ rb_define_method(rb_cPathname, "open", path_open, -1); rb_define_method(rb_cPathname, "readlink", path_readlink, 0); rb_define_method(rb_cPathname, "rename", path_rename, 1); + rb_define_method(rb_cPathname, "stat", path_stat, 0); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/