From 3121057559fa8848c734c6dc270b3ff4a1c370a2 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 31 Aug 2010 12:11:02 +0000 Subject: * ext/pathname/pathname.c (path_exist_p): Pathname#exist? translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'ext/pathname') diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index de1c301c0f..3257ef0271 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -486,9 +486,6 @@ end class Pathname # * FileTest * - # See FileTest.exist?. - def exist?() FileTest.exist?(@path) end - # See FileTest.grpowned?. def grpowned?() FileTest.grpowned?(@path) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 005b4a2457..c635201053 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -633,6 +633,15 @@ path_executable_real_p(VALUE self) return rb_funcall(rb_mFileTest, rb_intern("executable_real?"), 1, get_strpath(self)); } +/* + * See FileTest.exist?. + */ +static VALUE +path_exist_p(VALUE self) +{ + return rb_funcall(rb_mFileTest, rb_intern("exist?"), 1, get_strpath(self)); +} + /* * == Pathname * @@ -866,4 +875,5 @@ Init_pathname() rb_define_method(rb_cPathname, "chardev?", path_chardev_p, 0); rb_define_method(rb_cPathname, "executable?", path_executable_p, 0); rb_define_method(rb_cPathname, "executable_real?", path_executable_real_p, 0); + rb_define_method(rb_cPathname, "exist?", path_exist_p, 0); } -- cgit v1.2.3