Created
October 25, 2013 18:13
-
-
Save frahugo/7159276 to your computer and use it in GitHub Desktop.
Ruby tips
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
nil.nil? => true | |
"".nil? => false | |
nil.blank? => true | |
"".blank? => true | |
[].blank? => true | |
{}.blank? => true | |
[1,2].blank? => false | |
true.blank? => false | |
false.blank? => true | |
nil.present? => false | |
"".present? => false | |
[].present? => false | |
{}.present? => false | |
[1,2].present? => true | |
true.present? => true | |
false.present? => false | |
"".empty? => true | |
[].empty? => true | |
[1,2].empty? => false | |
nil.empty? => NoMethodError: undefined method `empty?' for nil:NilClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment