Trans schrieb:
> Robert Klemme wrote:
>>What do you mean by "Enumerable doesn't support args"?  It's a module not a
>>method.  What do you need those args for?
> 
> A good exmaple is ObjectSpace:
> 
>   class << ObjectSpace
>     include EnumerableArgs
>     alias :each, :each_object
>   end
> 
>   ObjectSpace.select(Class) { |c| c.name =~ /^S/ }
> 
> You can't do this with regular Enumerable b/c you cannot pass any
> arguments through the enumerable methods to the underlying #each
> method.

require "enumerator"

ObjectSpace.enum_for(:each_object, Class).select { |c| c.name =~ /^S/ }

Regards,
Pit