[前][次][番号順一覧][スレッド一覧]

ruby-changes:17204

From: akr <ko1@a...>
Date: Thu, 9 Sep 2010 22:43:42 +0900 (JST)
Subject: [ruby-changes:17204] Ruby:r29204 (trunk): * ext/pathname/pathname.c (path_size): Pathname#size translated from

akr	2010-09-09 22:43:37 +0900 (Thu, 09 Sep 2010)

  New Revision: 29204

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29204

  Log:
    * ext/pathname/pathname.c (path_size): Pathname#size translated from
      pathname.rb.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pathname/lib/pathname.rb
    trunk/ext/pathname/pathname.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29203)
+++ ChangeLog	(revision 29204)
@@ -1,3 +1,8 @@
+Thu Sep  9 22:39:08 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_size): Pathname#size translated from
+	  pathname.rb.
+
 Thu Sep  9 22:34:48 2010  wanabe  <s.wanabe@g...>
 
 	* compile.c (case_when_optimizable_literal): When float value can be
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 29203)
+++ ext/pathname/lib/pathname.rb	(revision 29204)
@@ -486,9 +486,6 @@
 
 class Pathname    # * FileTest *
 
-  # See <tt>FileTest.size</tt>.
-  def size() FileTest.size(@path) end
-
   # See <tt>FileTest.size?</tt>.
   def size?() FileTest.size?(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 29203)
+++ ext/pathname/pathname.c	(revision 29204)
@@ -742,6 +742,15 @@
 }
 
 /*
+ * See <tt>FileTest.size</tt>.
+ */
+static VALUE
+path_size(VALUE self)
+{
+    return rb_funcall(rb_mFileTest, rb_intern("size"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -986,4 +995,5 @@
     rb_define_method(rb_cPathname, "readable_real?", path_readable_real_p, 0);
     rb_define_method(rb_cPathname, "setuid?", path_setuid_p, 0);
     rb_define_method(rb_cPathname, "setgid?", path_setgid_p, 0);
+    rb_define_method(rb_cPathname, "size", path_size, 0);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]