Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Ruby community has put an incredible amount of attention to automating this idiom. These are the solutions I know of:</p> <ul> <li><a href="http://ryandaigle.com/articles/2008/11/20/what-s-new-in-edge-rails-object-try" rel="nofollow noreferrer">try</a> in Ruby on Rails</li> <li>Another <a href="http://ruby.tie-rack.org/53/a-better-try-chaining-methods-and-nil/" rel="nofollow noreferrer">try</a></li> <li><a href="http://weblog.raganwald.com/2008/01/objectandand-objectme-in-ruby.html" rel="nofollow noreferrer">andand</a></li> <li>A safer <a href="http://github.com/raganwald/rewrite_rails/tree/master" rel="nofollow noreferrer">andand</a></li> <li><a href="http://facets.rubyforge.org/quick/rdoc/core/classes/Kernel.html#M000368" rel="nofollow noreferrer">Kernel::ergo</a></li> <li><a href="http://rhnh.net/2007/10/02/object-send-with-default" rel="nofollow noreferrer">send-with-default</a></li> <li><a href="http://weavejester.com/node/10" rel="nofollow noreferrer">maybe</a></li> <li><a href="http://hobocentral.net/blog/2007/08/25/quiz/" rel="nofollow noreferrer">_?</a></li> <li><a href="http://recursive.ca/hutch/2007/11/22/a-little-unnecessary-smalltalk-envy/" rel="nofollow noreferrer">if-not-nil</a></li> <li><a href="http://chalain.livejournal.com/66798.html" rel="nofollow noreferrer">turtles!</a></li> <li><a href="http://www.urubatan.info/2008/03/a-better-try-for-ruby-why-not-do-the-groovy-way/" rel="nofollow noreferrer">method_</a> in Groovy style</li> <li><a href="http://www.bencurtis.com/archives/2008/03/do-or-do-not/" rel="nofollow noreferrer">do-or-do-not</a></li> </ul> <p>The most well-known is probably the <a href="http://ryandaigle.com/articles/2008/11/20/what-s-new-in-edge-rails-object-try" rel="nofollow noreferrer">try method</a> in Rails. However, it has received <a href="http://blog.lawrencepit.com/2009/01/11/try-as-you-might/" rel="nofollow noreferrer">some</a> <a href="http://github.com/raganwald/homoiconic/blob/master/2008-12-16/welcome.md" rel="nofollow noreferrer">criticism</a>.</p> <p>In any case, I think Ben's solution is perfectly sufficient.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload