Created
August 1, 2014 06:06
-
-
Save kkismd/f8ffad2e285e996d13c0 to your computer and use it in GitHub Desktop.
Uncertain method chain without #try, another ver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Kernel | |
def maybe | |
block_given? && yield | |
rescue NoMethodError | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How To Use
<%= maybe { foo.bar.baz } %>