Ternary operator should not be used for multiline conditions. If you want to avoid full condition what about:
```ruby
task.result_description.tap { |d| return d.gsub "\n", '<br/>' if d.is_a? String }
```