summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 01:44:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 01:44:58 +0000
commit15f26afdf0cf3f188a20456512c829290187b68d (patch)
tree8f488d6eecad7f15ebfa18556621ebb3ec217dd6
parentf281353ffda7672f668a49090314fc9d2384a529 (diff)
* array.c (rb_ary_reject_bang, rb_ary_delete_if): update rdoc.
documentation from Thomas Leitner <t_leitner AT gmx.at> in [ruby-core:41616]. [Bug #5752] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--array.c4
-rw-r--r--test/ruby/test_array.rb4
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 02260976f4..15f164e096 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Dec 15 10:44:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_reject_bang, rb_ary_delete_if): update rdoc.
+ documentation from Thomas Leitner <t_leitner AT gmx.at> in
+ [ruby-core:41616]. [Bug #5752]
+
Thu Dec 15 10:10:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/test_require.rb (test_race_exception): get rid of
diff --git a/array.c b/array.c
index cfe44a9015..01cabc87b9 100644
--- a/array.c
+++ b/array.c
@@ -2643,6 +2643,8 @@ ary_reject_bang(VALUE ary)
* Equivalent to Array#delete_if, deleting elements from
* +self+ for which the block evaluates to true, but returns
* <code>nil</code> if no changes were made.
+ * The array is changed instantly every time the block is called and
+ * not after the iteration is over.
* See also Enumerable#reject and Array#delete_if.
*
* If no block is given, an enumerator is returned instead.
@@ -2687,6 +2689,8 @@ rb_ary_reject(VALUE ary)
*
* Deletes every element of +self+ for which +block+ evaluates
* to true.
+ * The array is changed instantly every time the block is called and
+ * not after the iteration is over.
* See also Array#reject!
*
* If no block is given, an enumerator is returned instead.
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 8f1d53d933..28d3e4156b 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -610,7 +610,7 @@ class TestArray < Test::Unit::TestCase
bug2545 = '[ruby-core:27366]'
a = @cls[ 5, 6, 7, 8, 9, 10 ]
- assert_equal(9, a.delete_if {|i| break i if i > 8; i < 7})
+ assert_equal(9, a.delete_if {|i| break i if i > 8; assert_equal(a[0], i) || true if i < 7})
assert_equal(@cls[7, 8, 9, 10], a, bug2545)
end
@@ -1098,7 +1098,7 @@ class TestArray < Test::Unit::TestCase
bug2545 = '[ruby-core:27366]'
a = @cls[ 5, 6, 7, 8, 9, 10 ]
- assert_equal(9, a.reject! {|i| break i if i > 8; i < 7})
+ assert_equal(9, a.reject! {|i| break i if i > 8; assert_equal(a[0], i) || true if i < 7})
assert_equal(@cls[7, 8, 9, 10], a, bug2545)
end