mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/matrix.rb (Vector#each): Return self and optimization [ruby-core:28405]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
871e9d175e
commit
b81e045712
2 changed files with 8 additions and 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>
|
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.
|
* hash.c (rb_hash_select_bang): add #select! and keep_if to Hash.
|
||||||
|
|
|
@ -1144,11 +1144,10 @@ class Vector
|
||||||
#
|
#
|
||||||
# Iterate over the elements of this vector
|
# Iterate over the elements of this vector
|
||||||
#
|
#
|
||||||
def each
|
def each(&block)
|
||||||
return to_enum(:each) unless block_given?
|
return to_enum(:each) unless block_given?
|
||||||
@elements.each do |i|
|
@elements.each(&block)
|
||||||
yield i
|
self
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue