ruby-changes:17106
From: akr <ko1@a...>
Date: Fri, 27 Aug 2010 05:18:16 +0900 (JST)
Subject: [ruby-changes:17106] Ruby:r29106 (trunk): * ext/pathname/pathname.c (path_sysopen): Pathname#sysopen translated
akr 2010-08-27 05:16:25 +0900 (Fri, 27 Aug 2010) New Revision: 29106 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29106 Log: * ext/pathname/pathname.c (path_sysopen): Pathname#sysopen translated from pathname.rb. Modified files: trunk/ChangeLog trunk/ext/pathname/lib/pathname.rb trunk/ext/pathname/pathname.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29105) +++ ChangeLog (revision 29106) @@ -1,3 +1,8 @@ +Fri Aug 27 05:11:51 2010 Tanaka Akira <akr@f...> + + * ext/pathname/pathname.c (path_sysopen): Pathname#sysopen translated + from pathname.rb. + Thu Aug 26 22:53:56 2010 Nobuyoshi Nakada <nobu@r...> * array.c (rb_ary_shuffle): rdoc fix. argument name was missing. Index: ext/pathname/lib/pathname.rb =================================================================== --- ext/pathname/lib/pathname.rb (revision 29105) +++ ext/pathname/lib/pathname.rb (revision 29106) @@ -483,13 +483,7 @@ end end -class Pathname # * IO * - # See <tt>IO.sysopen</tt>. - def sysopen(*args) IO.sysopen(@path, *args) end -end - - class Pathname # * FileTest * # See <tt>FileTest.blockdev?</tt>. Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 29105) +++ ext/pathname/pathname.c (revision 29106) @@ -321,6 +321,24 @@ } /* + * call-seq: + * pathname.sysopen([mode, [perm]]) -> fixnum + * + * See <tt>IO.sysopen</tt>. + * + */ +static VALUE +path_sysopen(int argc, VALUE *argv, VALUE self) +{ + VALUE args[3]; + int n; + + args[0] = get_strpath(self); + n = rb_scan_args(argc, argv, "02", &args[1], &args[2]); + return rb_funcall2(rb_cIO, rb_intern("sysopen"), 1+n, args); +} + +/* * See <tt>File.atime</tt>. Returns last access time. */ static VALUE @@ -783,6 +801,7 @@ rb_define_method(rb_cPathname, "read", path_read, -1); rb_define_method(rb_cPathname, "binread", path_binread, -1); rb_define_method(rb_cPathname, "readlines", path_readlines, -1); + rb_define_method(rb_cPathname, "sysopen", path_sysopen, -1); rb_define_method(rb_cPathname, "atime", path_atime, 0); rb_define_method(rb_cPathname, "ctime", path_ctime, 0); rb_define_method(rb_cPathname, "mtime", path_mtime, 0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/