diff --git a/ChangeLog b/ChangeLog index 0078399940..72c32e2897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 3 23:51:26 2010 Tanaka Akira + + * ext/pathname/pathname.c (path_socket_p): Pathname#socket? + translated from pathname.rb. + Fri Sep 3 06:40:44 2010 Nobuyoshi Nakada * ext/pty/pty.c (chfunc): pass through exceptions. diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index aa46a91c49..4343de180e 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -486,9 +486,6 @@ end class Pathname # * FileTest * - # See FileTest.socket?. - def socket?() FileTest.socket?(@path) end - # See FileTest.owned?. def owned?() FileTest.owned?(@path) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 6a24b84b47..98b0515402 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -678,6 +678,15 @@ path_pipe_p(VALUE self) return rb_funcall(rb_mFileTest, rb_intern("pipe?"), 1, get_strpath(self)); } +/* + * See FileTest.socket?. + */ +static VALUE +path_socket_p(VALUE self) +{ + return rb_funcall(rb_mFileTest, rb_intern("socket?"), 1, get_strpath(self)); +} + /* * == Pathname * @@ -916,4 +925,5 @@ Init_pathname() rb_define_method(rb_cPathname, "directory?", path_directory_p, 0); rb_define_method(rb_cPathname, "file?", path_file_p, 0); rb_define_method(rb_cPathname, "pipe?", path_pipe_p, 0); + rb_define_method(rb_cPathname, "socket?", path_socket_p, 0); }