Oh I see, thanks Kevin et al. You learn something new everyday. Somedays you're lucky enough to learn something useful!
On Mar 3, 2009, at 15:23, Kevin Clark <[email protected]> wrote: > > ? a : b > > Is from C. It means: (condition) ? (if true) : (if false) > > (1 + 1 == 2) ? "foo" : "bar" # => "foo" > > On Tue, Mar 3, 2009 at 3:16 PM, David A McClain <[email protected] > > wrote: >> I can understand what that code is doing because I know the >> context, but >> otherwise I'd be lost. >> What does the "? a : b" bit actually do? I've never seen the colon >> operator. >> >> >> >> On Mar 3, 2009, at 14:02, Jordan Fowler <[email protected]> wrote: >> >> I would probably just use tertiary as the argument to render: >> render a.exists? ? a : b >> -Jordan >> On Mar 3, 2009, at 12:59 PM, Guyren G Howe wrote: >> >> What's the most elegant way to do: >> >> if a exists >> render a >> else >> render b >> end >> >> ? >> >> I was going to write a helper that just relies on the exception, >> but I >> wondered if there was already a concise way to do this. >> >> >> >> >> >> >> --------------------------------------------------------------- >> Jordan A. Fowler >> 2928 Fir St. >> San Diego, CA 92102 >> E-mail: [email protected] >> Website: http://www.jordanfowler.com >> Phone: (619) 339-6752 >> >> >> >>> >> > > > > -- > Kevin Clark > http://glu.ttono.us > > > --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---
