* 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
This commit is contained in:
parent
132161da69
commit
58b14e7892
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jun 10 09:52:38 2011 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* encoding.c: Mention that Encoding.compatible? can work with more
|
||||||
|
than just Strings.
|
||||||
|
|
||||||
Fri Jun 10 02:25:53 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
Fri Jun 10 02:25:53 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* ext/psych/lib/psych.rb: updating version to match released gem.
|
* ext/psych/lib/psych.rb: updating version to match released gem.
|
||||||
|
16
encoding.c
16
encoding.c
@ -1042,12 +1042,13 @@ enc_find(VALUE klass, VALUE enc)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Encoding.compatible?(str1, str2) -> enc or nil
|
* Encoding.compatible?(obj1, obj2) -> enc or nil
|
||||||
*
|
*
|
||||||
* Checks the compatibility of two strings.
|
* Checks the compatibility of two objects.
|
||||||
* If they are compatible, means concatenatable,
|
*
|
||||||
* returns an encoding which the concatenated string will be.
|
* If the objects are both strings they are compatible when they are
|
||||||
* If they are not compatible, nil is returned.
|
* 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.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
|
||||||
* #=> #<Encoding:ISO-8859-1>
|
* #=> #<Encoding:ISO-8859-1>
|
||||||
@ -1057,6 +1058,11 @@ enc_find(VALUE klass, VALUE enc)
|
|||||||
* "\xa1\xa1".force_encoding("euc-jp"))
|
* "\xa1\xa1".force_encoding("euc-jp"))
|
||||||
* #=> nil
|
* #=> 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
|
static VALUE
|
||||||
enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
|
enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user