From: Daniel Moore Date: 2009-10-25T02:44:27+09:00 Subject: [QUIZ] Enumerable ObjectSpace (#222) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The three rules of Ruby Quiz: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have elapsed from the time this message was sent. 2. Support Ruby Quiz by submitting ideas and responses as often as you can. 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RSS Feed: http://rubyquiz.strd6.com/quizzes.rss Suggestions?: http://rubyquiz.strd6.com/suggestions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ## Enumerable ObjectSpace (#222) Kaixo Rubyists, This week's quiz was suggested by Trans[1]. ObjectSpace has the method #each_object. I've always wanted to alias that to #each and make ObjectSpace Enumerable. But there's a catch, #each_object takes an argument and Enumerable does not pass arguments on to the #each method. So how does one resolve this issue? What's the easiest way to make ObjectSpace Enumerable? One could always take the brute force approach and completely re-implement Enumerable module to pass along the arguments. But I'm hoping there are much more elegant solutions to be had. Have fun! [1]: http://rubyworks.github.com -- -Daniel http://rubyquiz.strd6.com