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

ruby-changes:8100

From: tadf <ko1@a...>
Date: Mon, 29 Sep 2008 22:55:56 +0900 (JST)
Subject: [ruby-changes:8100] Ruby:r19626 (trunk): * lib/mathn.rb: added String#to_[rc].

tadf	2008-09-29 22:55:39 +0900 (Mon, 29 Sep 2008)

  New Revision: 19626

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

  Log:
    * lib/mathn.rb: added String#to_[rc].

  Modified files:
    trunk/ChangeLog
    trunk/lib/mathn.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19625)
+++ ChangeLog	(revision 19626)
@@ -1,3 +1,7 @@
+Mon Sep 29 22:54:29 2008  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/mathn.rb: added String#to_[rc].
+
 Mon Sep 29 20:41:19 2008  Tanaka Akira  <akr@f...>
 
 	* string.c (rb_str_subseq): use rb_str_drop_bytes if possible.
Index: lib/mathn.rb
===================================================================
--- lib/mathn.rb	(revision 19625)
+++ lib/mathn.rb	(revision 19626)
@@ -61,6 +61,8 @@
   remove_method :/
   alias / quo
 
+  def_canon *(instance_methods - Object.methods - [:canon])
+
   alias power! **
 
   def ** (other)
@@ -71,14 +73,14 @@
     end
   end
 
-  def_canon *(instance_methods - Object.methods - [:canon])
-
 end
 
 class Bignum
   remove_method :/
   alias / quo
 
+  def_canon *(instance_methods - Object.methods - [:canon])
+
   alias power! **
 
   def ** (other)
@@ -89,8 +91,6 @@
     end
   end
 
-  def_canon *(instance_methods - Object.methods - [:canon])
-
 end
 
 alias RationalOrig Rational
@@ -277,6 +277,18 @@
 
 end
 
+class String
+
+  alias to_r_orig to_r
+  private :to_r_orig
+  def to_r() to_r_orig.__send__(:canon) end
+
+  alias to_c_orig to_c
+  private :to_c_orig
+  def to_c() to_c_orig.__send__(:canon) end
+
+end
+
 class Float
 
   def_canon *(instance_methods - Object.methods - [:canon])

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

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