if a
  render a
else
  render b
end

Sounds pretty elegant to me. Other stuff would just hide the simple
branch operation in magic. The tertiary if could clean it a little,
but it seems like it obfuscates all but the simplest code.

On Tue, Mar 3, 2009 at 12:59 PM, Guyren G Howe <[email protected]> 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.
>
> >
>



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

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to