naught_check
Why?
Got tired of string.empty? checks in a project blowing up on nil strings.
Usage:
require 'naught_check'
include Naught
nil.naught? => true
"".naught? => true
" ".naught? => true
[].naught? => true
{}.naught? => true
0.naught? => true
0.00.naught? => true
Compared to ActiveSupport .blank?
In a Rails project, ActiveSupport .blank? would do almost the same thing, except for numbers:
0.blank? => false
0.naught? => true
It’s like ActiveSupport .blank? combined with a nil-safe Numeric .zero?
Copyright
Copyright © 2010 Sean Miller. See LICENSE for details.