From 739e022d006b755b4c6641eda958bdfb5969b65d Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 8 Aug 2010 04:21:26 +0000 Subject: * ext/pathname/pathname.c (path_ftype): Pathname#ftype translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pathname/pathname.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ext/pathname/pathname.c') diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 81b6d23e6d..4ed17f4efd 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -314,6 +314,16 @@ path_fnmatch(int argc, VALUE *argv, VALUE self) return rb_funcall(rb_cFile, rb_intern("fnmatch"), 3, pattern, str, flags); } +/* + * See File.ftype. 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 * @@ -523,4 +533,5 @@ Init_pathname() 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); } -- cgit v1.2.3