J
Joe Edelman
Hi Folks,
Is there any way to get something like this to work?
class Proc
def to_ary(ct)
a = []
l = lambda { |x|
a << x
ct -= 1
break if ct == 0
}
call(&l)
return a
end
end
p lambda {
yield 1
yield 2
yield 3
yield 4
yield 5
yield 6
yield 7
}.to_ary(5)
# would like this to be [1, 2, 3, 4, 5]
Thanks,
--Joe
Is there any way to get something like this to work?
class Proc
def to_ary(ct)
a = []
l = lambda { |x|
a << x
ct -= 1
break if ct == 0
}
call(&l)
return a
end
end
p lambda {
yield 1
yield 2
yield 3
yield 4
yield 5
yield 6
yield 7
}.to_ary(5)
# would like this to be [1, 2, 3, 4, 5]
Thanks,
--Joe