From: Christoph Rippel Date: 2001-02-26T08:40:50+09:00 Subject: [ruby-talk:11555] Re: Array bugs? > From: Christoph Rippel [mailto:crippel@primenet.com] [...] Sorry has usual .. > class Array > def no_loop (id_bag) > level_id_bag = IdBag.new > each do |r| > next if level_id_bag.included_pair? id, r.id > level_id_bag.include_pair id, r.id > return false unless r.detect_loop (id_bag) ^^^^^^^^^^ return false unless r.no_loop (id_bag) > return false if id_bag.included_pair? id, r.id > id_bag.include_pair id,r.id > end > return true > end [...] > class Array > def protected_hash (level) > return id if level < 1 ^^^ > hsh = id ^^ > each do |i| > hsh ^= i.protected_hash (level- 1) > end > return hsh > end [...] Christoph