ruby-changes:16922
From: akr <ko1@a...>
Date: Sun, 8 Aug 2010 13:21:41 +0900 (JST)
Subject: [ruby-changes:16922] Ruby:r28918 (trunk): * ext/pathname/pathname.c (path_ftype): Pathname#ftype translated
akr 2010-08-08 13:21:26 +0900 (Sun, 08 Aug 2010) New Revision: 28918 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28918 Log: * ext/pathname/pathname.c (path_ftype): Pathname#ftype translated from pathname.rb. Modified files: trunk/ChangeLog trunk/ext/pathname/lib/pathname.rb trunk/ext/pathname/pathname.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28917) +++ ChangeLog (revision 28918) @@ -1,3 +1,8 @@ +Sun Aug 8 13:20:57 2010 Tanaka Akira <akr@f...> + + * ext/pathname/pathname.c (path_ftype): Pathname#ftype translated + from pathname.rb. + Sun Aug 8 12:41:19 2010 Nobuyoshi Nakada <nobu@r...> * parse.y (parser_tokadd_escape): no similar messages twice. Index: ext/pathname/lib/pathname.rb =================================================================== --- ext/pathname/lib/pathname.rb (revision 28917) +++ ext/pathname/lib/pathname.rb (revision 28918) @@ -512,10 +512,6 @@ class Pathname # * File * - # See <tt>File.ftype</tt>. Returns "type" of file ("file", "directory", - # etc). - def ftype() File.ftype(@path) end - # See <tt>File.link</tt>. Creates a hard link. def make_link(old) File.link(old, @path) end Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 28917) +++ ext/pathname/pathname.c (revision 28918) @@ -315,6 +315,16 @@ } /* + * See <tt>File.ftype</tt>. Returns "type" of file ("file", "directory", + * etc). + */ +static VALUE +path_ftype(VALUE self) +{ + return rb_funcall(rb_cFile, rb_intern("ftype"), 1, get_strpath(self)); +} + +/* * == Pathname * * Pathname represents a pathname which locates a file in a filesystem. @@ -523,4 +533,5 @@ rb_define_method(rb_cPathname, "lchown", path_lchown, 2); rb_define_method(rb_cPathname, "fnmatch", path_fnmatch, -1); rb_define_method(rb_cPathname, "fnmatch?", path_fnmatch, -1); + rb_define_method(rb_cPathname, "ftype", path_ftype, 0); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/