1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/matrix (column): handle negative arguments. cf [ruby-core:23598]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-10-24 06:04:56 +00:00
parent e5af8e940b
commit 90d244aded

View file

@ -309,13 +309,13 @@ class Matrix
#
def column(j) # :yield: e
if block_given?
return self if j >= column_size
return self if j >= column_size || j < -column_size
row_size.times do |i|
yield @rows[i][j]
end
self
else
return nil if j >= column_size
return nil if j >= column_size || j < -column_size
col = (0 ... row_size).collect {|i|
@rows[i][j]
}