# File Ouroboros.rb, line 111 def initialize( size, template={}, &initialize_block ) initialize_block = Proc.new{ template.dup } unless block_given? @all = Array.new size, &initialize_block @size = size prev = @all.last @all.each_with_index{ |o,i| o.extend( PrevNext ) o.prev = prev o.next = @all[(i+1) % @size] o._ouroboros_index = i prev = o } @current = @all[ @current_index=0 ] end