Feature #6737 ยป hash.patch
hash.c | ||
---|---|---|
rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
|
||
rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
|
||
rb_define_method(rb_cHash,"retrieve", rb_hash_aref, 1);
|
||
rb_define_method(rb_cHash,"hash", rb_hash_hash, 0);
|
||
rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1);
|
||
rb_define_method(rb_cHash,"fetch", rb_hash_fetch_m, -1);
|
test/ruby/test_hash.rb | ||
---|---|---|
y = {1=>2, 2=>4, 3=>6} # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
|
||
assert_equal(2, x[1])
|
||
assert_equal(2, x.retrieve(1))
|
||
assert(begin
|
||
for k,v in y
|