[Sdruby] unfamiliar ruby construct

Kevin Clark kevin.clark at gmail.com
Fri Jun 22 21:30:14 GMT 2007


It explicitly casts to a boolean. This isn't useful (or preferred) in
_most_ cases. In this case, nil? already returns true/false, so
there's not really a point.

On 6/22/07, Glenn Little <little at cs.ucsd.edu> wrote:
> Found this in the restful auth code:
>
>   def activated?
>     !! activation_code.nil?
>   end
>
> What is the "!!"?  "not not"?  Is it a way of
> doing a cast or something?  (If so, why is
> it needed?)
>
>         -glenn
> _______________________________________________
> Sdruby mailing list
> Sdruby at lists.sdruby.com
> http://lists.sdruby.com/mailman/listinfo/sdruby
>


-- 
Kevin Clark
http://glu.ttono.us


More information about the Sdruby mailing list