On Thu, Aug 28, 2008 at 8:59 PM, David A. Black <dblack / rubypal.com> wrote:
> Hi --
> On Fri, 29 Aug 2008, Patrick Doyle wrote:
>> and I would also like to know why
>>
>> x = Array.new()
>> => []
>> x === Array
>> => false
>
>> I've just got to teach [myself] to use:
>>
>> case x
>> when Array
>>  ...
>> end
>>
>> instead of
>> if x === Array
>>  ...
>> end
>>
>> ...the few times I want to do something only when x is an array.
>
> You can do:
>
>  if Array === x
>
> === is the case equality operator, so this:
>
>  case obj
>  when x
>
> is like this:
>
>  if x === obj

Ahhh.... that makes perfect sense!  (And I mean that in the "light
dawns on marble head" sort of way, not in the sarcastic sort of way.)

Thanks....

BTW... I've not had any luck Googling "ruby === class type" sorts of
stuff.  So I just figured I would have to live w/o knowing the answer
to this puzzling question.

And now I know the answer.

And the answer makes intuitive sense.

Life is good.

Thanks again :-)

--wpd