7stud -- wrote in post #998575:
> aix aix wrote in post #998497:
>> How to use a[6] as above ?
>>
>> Thanks
>
> You want Array#cycle.


Here's an example using Enumerator#next:

a = [1, 0, 1, 1, 0, 0, 1]
b = ["101101", "101100", "110011", "000111", "010110"]

enum = a.cycle

b.each do |str|
  int_arr = str.split(//).map(&:to_i)

  result_arr = int_arr.map do |int|
    int ^ enum.next
  end

  p result_arr.join('')
end

--output:--
"000001"
"011010"
"101000"
"001010"
"110000"

-- 
Posted via http://www.ruby-forum.com/.