aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-13 08:10:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-13 08:10:28 +0000
commit62f8f1419c2d666a113d02f021c20673a0f49d48 (patch)
tree20943db9920050d311f0b5024cd9a39ace351e45
parent5cb7d10ee065d6141a6d6e796aecbb278b54f171 (diff)
downloadruby-62f8f1419c2d666a113d02f021c20673a0f49d48.tar.gz
* hash.c (rb_hash_compare_by_identity): rename Hash#identical to
Hash#compare_by_identity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--hash.c24
-rw-r--r--lib/rexml/encodings/UTF-16.rb2
2 files changed, 13 insertions, 13 deletions
diff --git a/hash.c b/hash.c
index 02a40b0444..337007c39e 100644
--- a/hash.c
+++ b/hash.c
@@ -1482,22 +1482,22 @@ static struct st_hash_type identhash = {
/*
* call-seq:
- * hsh.compare_by_identity => hsh
+ * hsh.identical => hsh
*
* Makes <i>hsh</i> to compare its keys by their identity, i.e. it
* will consider exact same objects as same keys.
*
* h1 = { "a" => 100, "b" => 200, :c => "c" }
- * h1["a"] #=> "a"
- * h1.compare_by_identity
- * h1.compare_by_identity? #=> true
- * h1["a"] #=> nil # different objects.
- * h1[:c] #=> "c" # same symbols are all same.
+ * h1["a"] #=> "a"
+ * h1.identical
+ * h1.identical? #=> true
+ * h1["a"] #=> nil # different objects.
+ * h1[:c] #=> "c" # same symbols are all same.
*
*/
static VALUE
-rb_hash_compare_by_identity(VALUE hash)
+rb_hash_identical(VALUE hash)
{
rb_hash_modify(hash);
RHASH(hash)->tbl->type = &identhash;
@@ -1507,15 +1507,15 @@ rb_hash_compare_by_identity(VALUE hash)
/*
* call-seq:
- * hsh.compare_by_identity? => true or false
+ * hsh.identical? => true or false
*
* Returns <code>true</code> if <i>hsh</i> will compare its keys by
- * their identity. Also see <code>Hash#compare_by_identity</code>.
+ * their identity. Also see <code>Hash#identical</code>.
*
*/
static VALUE
-rb_hash_compare_by_identity_p(VALUE hash)
+rb_hash_identical_p(VALUE hash)
{
if (RHASH(hash)->tbl->type == &identhash) {
return Qtrue;
@@ -2372,8 +2372,8 @@ Init_Hash(void)
rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);
- rb_define_method(rb_cHash,"compare_by_identity", rb_hash_compare_by_identity, 0);
- rb_define_method(rb_cHash,"compare_by_identity?", rb_hash_compare_by_identity_p, 0);
+ rb_define_method(rb_cHash,"identical", rb_hash_identical, 0);
+ rb_define_method(rb_cHash,"identical?", rb_hash_identical_p, 0);
#ifndef __MACOS__ /* environment variables nothing on MacOS. */
origenviron = environ;
diff --git a/lib/rexml/encodings/UTF-16.rb b/lib/rexml/encodings/UTF-16.rb
index 792adfd44d..007c493d9c 100644
--- a/lib/rexml/encodings/UTF-16.rb
+++ b/lib/rexml/encodings/UTF-16.rb
@@ -16,7 +16,7 @@ module REXML
end
def decode_utf16(str)
- str = str[2..-1] if /^\376\377/ =~ str
+ str = str[2..-1] if /^\376\377/n =~ str
array_enc=str.unpack('C*')
array_utf8 = []
0.step(array_enc.size-1, 2){|i|