mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
modified test helper to keep compatibility for Ruby 1.8
This commit is contained in:
parent
84c3270bf4
commit
5ddfc1fa45
1 changed files with 5 additions and 5 deletions
|
@ -23,16 +23,16 @@ class OpenCVTestCase < Test::Unit::TestCase
|
|||
original_aref(*idx)
|
||||
end
|
||||
|
||||
def []=(*idx, val)
|
||||
if idx.size == 1
|
||||
n = idx[0]
|
||||
def []=(*args)
|
||||
if args.size == 2
|
||||
n = args[0] # index
|
||||
throw ArgumentError.new("index #{n} is out of range") if n >= rows * cols
|
||||
else
|
||||
j, i = *idx
|
||||
j, i = *args
|
||||
throw ArgumentError.new("index for row #{j} is out of range") if j >= rows
|
||||
throw ArgumentError.new("index for column #{i} is out of range") if i >= cols
|
||||
end
|
||||
original_aset(*idx, val)
|
||||
original_aset(*args)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue