1
0
Fork 0
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:
ser1zw 2011-01-04 01:34:10 +09:00
parent 84c3270bf4
commit 5ddfc1fa45

View file

@ -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