-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The three rules of Ruby Q.:
-
Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent. -
Support Ruby Q. by submitting ideas and responses
as often as you can. -
Enjoy!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. 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 Trans1.
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!