Skip to content

Instantly share code, notes, and snippets.

@frahugo
Created October 25, 2013 18:13
Show Gist options
  • Save frahugo/7159276 to your computer and use it in GitHub Desktop.
Save frahugo/7159276 to your computer and use it in GitHub Desktop.
Ruby tips
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