The docs pretty clear...
If the block is not given, Ruby adds an implicit block of{|obj| obj}=A0(that
is=A0all? <Enumerable.html#M003131> =A0will return=A0true=A0only if none of the
collection members are=A0false=A0or=A0nil.)

Its an assumption is always true unless the block tells it something
different..

Assuimng Happy unless its told not to be happy! :-)

irb(main):019:0> [].all? {|e| puts e; e=3D=3D3}
=3D> true
irb(main):020:0> [].all? {|e| puts e; e=3D=3D2}
=3D> true
irb(main):021:0> [].all? {|e| puts e; e=3D=3D1}
=3D> true
irb(main):022:0> [].all? {|e| puts e; e=3D=3D100}
=3D> true
irb(main):023:0>=20


[].all? Is true..

Its interesting.

irb(main):019:0> [].all? {|e| e=3D=3D3}
=3D> true
irb(main):020:0> [].all? {|e| e=3D=3D2}
=3D> true
irb(main):021:0> [].all? {|e| e=3D=3D1}
=3D> true
irb(main):022:0> [].all? {|e| e=3D=3D100}
=3D> true
irb(main):023:0>=20


[].all? Is true..

Its interesting.


> From: John Sikora <john.sikora / xtera.com>
> Reply-To: <ruby-talk / ruby-lang.org>
> Newsgroups: comp.lang.ruby
> Date: Fri, 30 Jul 2010 06:27:52 +0900
> To: ruby-talk ML <ruby-talk / ruby-lang.org>
> Subject: [].all?{} and [].any?{} Behavior
>=20
> I find the following behavior interesting (so interesting that I
> modified it), and I would like to hear others' thoughts on the subject:
>=20
> [3].all? {|element| element =3D=3D 3 }  # =3D> true
> [3].all? {|element| element !=3D 3 }  #=A0=3D> false (sanity checks)
>=20
> [].all? {|element| element =3D=3D 3 }   # =3D> true
> [].all? {|element| element !=3D 3 }   # =3D> true
>=20
> [].any? {|element| element =3D=3D 3 }   # =3D> false
> [].any? {|element| element !=3D 3 }   # =3D> false
>=20
> Ruby 1.8.6 and 1.9.1 both give these results.
>=20
> The first interesting thing is that both the =3D=3D and the !=3D checks give
> the same logical result (always true for all?, always false for any?).
> After thinking about it a little, I decided that this is the desired
> behavior.
>=20
> I also understand why it happens. For example, in the case of all?, the
> documentation says that true will be the result if the block never
> returns false or nil. In the case of [], the block never gets called, so
> the result is true. I know the block never gets called because the
> following does not print anything:
>=20
> [].all? {|dummy| puts 'print something'}, while
>=20
> [3].all? {|dummy| puts 'print something'} does.
>=20
> The second interesting thing is that a result of this behavior is that
> for the same check, all? will give a result of true, while any? will
> give a result of false. This seems contradictory.
>=20
> I would prefer that for [], both all? and any? would give a result of
> false for any check. So I have over-ridden Array#all?, returning false
> if self =3D=3D []. My main motivation for doing so is in situautions such
> as:
>=20
> obj_array.find_all{|obj| obj.attr_1 =3D=3D x}.all?{|obj| obj.attr_2 =3D=3D y}
>=20
> If the find_all returns [], I want the all? result to be false, not
> true.
>=20
> I assume that others have run across this but some quick searches did
> not turn up anything. I am wondering how others deal with this such as
> over-riding as I do, checking for [] each time (which does not seem very
> Ruby-like), or even leaving the operation as is because for some, it may
> be the desired behavior.
>=20
> Finally, are there any potential detrimental effects that might occur
> due to the behavior modification that I made. I am not a Rails user (if
> that matters), I mainly use Ruby for scripting and hardware control
> applications (and I am interested in learning as much as I can about
> Ruby because I like it so much).
>=20
> js
> --=20
> Posted via http://www.ruby-forum.com/.
>=20