Links
ignore_nil
Categories
ignore_nil
ignore_nil lets you happily ignore nil methods on long method chains. Keeps code pretty and much safer than "rescue nil", since it only catches NoMethodError on nil objects.
ignore_nil {} will either return the last thing evaluated in the block, or nil if a NoMethodError is raised calling a method on a nil object. Any other exceptions raised in the block are not handled, and left for the application to resolve.
Vitals
| Home | http://github.com/ssoroka/ignore_nil/tree/master |
|---|---|
| Repository | git://github.com/ssoroka/ignore_nil.git |
| License | Rails' (MIT) |
| Tags |
ignore_nil nil NoMethodError
|
| Rating | (17 votes) |
| Owner | Steven Soroka |
| Created | 14 November 2008 |

