x.nil? or x.blank?

(x.nil? or x.blank?) is logically equivalent to x.blank? because nil is blank:

   nil.blank? # -> true

So the answer is yes, you are looking for blank? indeed :-).

-- fxn

After a quick test it appears that Rails must add the blank? method to nil. Ruby "out-of-the-box" reports that nil has no blank? method. Just FYI.

I want one that checks for empty + empty array....

That's blank? again.

In Rails blank? has an implementation in Object and a few special cases. For example in Array

   class Array #:nodoc:      alias_method :blank?, :empty?    end

In NilClass it returns true directly:

   class NilClass #:nodoc:      def blank?        true      end    end

And there are a few more. See activesupport/lib/active_support/core_ext/blank.rb.

-- fxn

oh duh....