diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 07:19:21 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 07:19:21 +0000 |
commit | 2cfb894d2a376becbc05938c4b67fc17ad8c26dd (patch) | |
tree | bdddca1dd6b00fe835694aa6ed15bc9b89b0a76a /lib/matrix.rb | |
parent | 006a8ba77f6c5e27201760dfe560eb0c63e4d70b (diff) |
* lib/matrix.rb (Vector#each): make Vector enumerable.
[ruby-core:28405]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r-- | lib/matrix.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index d452bf459e..a008182c42 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1081,6 +1081,7 @@ end # class Vector include ExceptionForMatrix + include Enumerable #INSTANCE CREATION @@ -1141,6 +1142,16 @@ class Vector #++ # + # Iterate over the elements of this vector + # + def each + return to_enum(:each) unless block_given? + @elements.each do |i| + yield i + end + end + + # # Iterate over the elements of this vector and +v+ in conjunction. # def each2(v) # :yield: e1, e2 |