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

ruby-changes:19931

From: drbrain <ko1@a...>
Date: Fri, 10 Jun 2011 09:53:02 +0900 (JST)
Subject: [ruby-changes:19931] drbrain:r31978 (trunk): * encoding.c: Mention that Encoding.compatible? can work with more

drbrain	2011-06-10 09:52:54 +0900 (Fri, 10 Jun 2011)

  New Revision: 31978

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

  Log:
    * encoding.c:  Mention that Encoding.compatible? can work with more
      than just Strings.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 31977)
+++ encoding.c	(revision 31978)
@@ -1042,13 +1042,14 @@
 
 /*
  * call-seq:
- *   Encoding.compatible?(str1, str2) -> enc or nil
+ *   Encoding.compatible?(obj1, obj2) -> enc or nil
  *
- * Checks the compatibility of two strings.
- * If they are compatible, means concatenatable,
- * returns an encoding which the concatenated string will be.
- * If they are not compatible, nil is returned.
+ * Checks the compatibility of two objects.
  *
+ * If the objects are both strings they are compatible when they are
+ * concatenatable.  The encoding of the concatenated string will be returned
+ * if they are compatible, nil if they are not.
+ *
  *   Encoding.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
  *   #=> #<Encoding:ISO-8859-1>
  *
@@ -1057,6 +1058,11 @@
  *     "\xa1\xa1".force_encoding("euc-jp"))
  *   #=> nil
  *
+ * If the objects are non-strings their encodings are compatible when they
+ * have an encoding and:
+ * * Either encoding is US ASCII compatible
+ * * One of the encodings is a 7-bit encoding
+ *
  */
 static VALUE
 enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31977)
+++ ChangeLog	(revision 31978)
@@ -1,3 +1,8 @@
+Fri Jun 10 09:52:38 2011  Eric Hodel  <drbrain@s...>
+
+	* encoding.c:  Mention that Encoding.compatible? can work with more
+	  than just Strings.
+
 Fri Jun 10 02:25:53 2011  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych.rb: updating version to match released gem.

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

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