From: Avi Bryant Date: 2001-06-19T04:28:03+09:00 Subject: [ruby-talk:16602] Re: RCR: Enumerable: every() and none() On Tue, 19 Jun 2001, Stephen White wrote: > In the spirit of incremental improvement... > > Assuming "== []" creates an empty Array for the purpose of comparision, > it would be a bit faster to do: > > def every(&block) > reject(&block).empty? > end > > def none(&block) > find_all(&block).empty? > end And a bit faster still to do: def every reject{|a| yield a}.empty? end def none find_all{|a| yield a}.empty? end