diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/matrix.rb | 7 |
2 files changed, 8 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Wed Mar 3 23:07:08 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca> + + * lib/matrix.rb (Vector#each): Return self and optimization + [ruby-core:28405] + Wed Mar 3 18:35:55 2010 Yukihiro Matsumoto <matz@ruby-lang.org> * hash.c (rb_hash_select_bang): add #select! and keep_if to Hash. diff --git a/lib/matrix.rb b/lib/matrix.rb index 3f27bcaeef..b3a7e79fe5 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1144,11 +1144,10 @@ class Vector # # Iterate over the elements of this vector # - def each + def each(&block) return to_enum(:each) unless block_given? - @elements.each do |i| - yield i - end + @elements.each(&block) + self end # |