diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-10 00:52:54 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-10 00:52:54 +0000 |
commit | 58b14e789273e3f9b05a54c9aa245d00f197d1ae (patch) | |
tree | c6f69122a3c51b7f85cab3cd2fa4a73be0e600ec /encoding.c | |
parent | 132161da6911b51f6c5807d696f59d16d1ce1d23 (diff) | |
download | ruby-58b14e789273e3f9b05a54c9aa245d00f197d1ae.tar.gz |
* encoding.c: Mention that Encoding.compatible? can work with more
than just Strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/encoding.c b/encoding.c index abc63f3c58..a88d176c0f 100644 --- a/encoding.c +++ b/encoding.c @@ -1042,12 +1042,13 @@ enc_find(VALUE klass, VALUE enc) /* * 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 @@ enc_find(VALUE klass, VALUE enc) * "\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) |