diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 84a2b5d61ba54c..b269c6169ede2c 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -1226,6 +1226,7 @@ Init_pathname() 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); + rb_define_method(rb_cPathname, "exists?", path_exist_p, 0); rb_define_method(rb_cPathname, "grpowned?", path_grpowned_p, 0); rb_define_method(rb_cPathname, "directory?", path_directory_p, 0); rb_define_method(rb_cPathname, "file?", path_file_p, 0); diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index ccdc5bd8ebe03c..c68c84c1ccec79 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -992,6 +992,7 @@ def test_exist? with_tmpchdir('rubytest-pathname') {|dir| open("f", "w") {|f| f.write "abc" } assert_equal(true, Pathname("f").exist?) + assert_equal(true, Pathname("f").exists?) } end