4. empty?
The Gist: returns true if the type is
empty. (Surprise!)
“”.empty? == true
{}.empty? == true
[].empty? == true
5. empty?
The Gist: returns true if the type is
empty. (Surprise!)
“ ”.empty?
“”.empty? == true == false
{}.empty? == true [nil,nil].empty?
== false
[].empty? == true {:k=>nil}.empty?
== false
6. nil?
nil? is kinda minimal.
Only two occurrences in my copy of
the RailsAPI.
On NilClass and Object.
(Both from the object.c source file.)
(http://ruby-doc.org/doxygen/1.8.4/object_8c-source.html)
15. present?
The opposite of blank? (That’s not a
question.)
# File activesupport/lib/active_support/core_ext/object/blank.rb, line 17
# (Ruby 1.9)
17: def present?
18: !blank?
19: end