Posted by jamie Thu, 23 Aug 2007 12:09:34 GMT
Just noticed something interesting (well not that interesting). Ternary operators in Ruby can be re-written using Boolean operators e.g.
method = object.respond_to?(:foo) ? :foo : :barwould become…
method = object.respond_to?(:foo) && :foo || :barSimply replace ? with && and : with ||
I don’t know if there is any performance gain here, anyone care to investigate?
