[Nitro] cookie.rb ?

akonsu akonsu at gmail.com
Tue Nov 15 17:34:38 EST 2005


thank you. is it really equivalent? the original code assigns
something to @expires in any case. your code makes this assignment
only if "t" evaluates to true. would you explain in more detail? i am
really confused....

2005/11/15, guillaume pierronnet <guillaume.pierronnet at gmail.com>:
> this is a boolean "and"
>
> this expression is equivalent:
>
> if t
>  @expires = t.is_a?(Time) ? t.httpdate : t.to_s
> end
>
> 2005/11/15, akonsu <akonsu at gmail.com>:
> > hello,
> >
> > could someone explain this code found in cookie.rb:
> >
> >   def expires=(t)
> >     @expires = t && (t.is_a?(Time) ? t.httpdate : t.to_s)
> >   end
> >
> > why does it need the "t &&" part?
> >
> > thanks
> > konstantin
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> >
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>




More information about the Nitro-general mailing list