Aurimas Aurimas - 4 months ago 6
Ruby Question

Ruby equivalend to Coffeescript shortened version of shorthand if operator?

How can you do this in Ruby?

In coffeescript you can do

name = a ? "bear"


Boolean or:

name = a || "bear"

To be precise, the following is an exact equivalent (there is no undefined in ruby):

name = a.nil? ? 'bear' : a