banister / remix

Ruby modules re-mixed and remastered
32 stars 1 forks source link

Strange behaviour of swap_modules on huge ancestor chains #11

Closed banister closed 13 years ago

banister commented 13 years ago
1000.times do 
  H.include Object.const_set($words.sample(5).join, 
                                          Module.new) 
end

100.times do 
  H.swap_modules(H.ancestors[rand(100) + 10], 
                            H.ancestors[rand(100) + 10]) 
end

Causes error: not a T_MODULE, T_CLASS, T_FALSE, T_ICLASS etc, and results in bizarrely truncated ancestor chain.

banister commented 13 years ago

fixed, probably was module was swapping with itself. added guard to prevent that happening