title: Ruby try not handling exception
body: <p>I have the following example ruby code:</p>
  
  <pre><code>def example_method(obj)
      ExampleClass.new(color1: @theme.try(obj['color1'].to_sym))
  end
  </code></pre>
  
  <p>Which should pass either the <code>obj['color1']</code> as a symbol or nil to the class.</p>
  
  <p>However if <code>color1</code> is not passed I get the error: <code>NoMethodError: undefined method 'to_sym' for nil:NilClass</code>.</p>
  
  <p>Shouldn't the try method be handling the exception?</p>
  
  <hr>
  
  <p>Update: based on comments... I solved it by doing a ternary:</p>
  
  <pre><code>ExampleClass.new(color1: obj['color1'].present? ? @brand_theme.try(obj['color1'].try(:to_sym)) : nil)
  </code></pre>