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:
parent
e5af8e940b
commit
90d244aded
1 changed files with 2 additions and 2 deletions
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue