tamouse mailing lists wrote in post #1089227:
> On Sat, Dec 15, 2012 at 9:26 AM, Eric Christopherson
>
> Now, that will all work. But it isn't idiomatic ruby.
>
>     print last_name.empty ? "," : "\"#{last_name}\","
>
> makes better use of ruby's expressiveness.
>

You forgot a question mark there:

>     print last_name.empty?  ? "," : "\"#{last_name}\","

Personally, I would never write a ternary operator that was so 
confusing.  Terseness should never be favored over clarity.  And Ruby 
has four different quoting mechanisms for strings, so resorting to 
escaping quote marks inside strings isn't necessary.


last_name = "Smith"
comma = ","
quoted_last_name = %Q{"#{last_name}"}

puts last_name.empty? ? comma : quoted_last_name

-- 
Posted via http://www.ruby-forum.com/.