views:

48

answers:

4

i know there some object has nil? method,i want to know is there some method with nil!?

A: 
w.nil?

inverse of

!w.nil?
shingara
A: 

There is a similar answered post here: a-concise-explanation-of-nil-v-empty-v-blank-in-ruby-on-rails

Summarizing:

If you are using rails (not just ruby) there are three methods in your toolkit: .nil?, .empty? and .blank?

Follow the link to see the good description

Jonathan
A: 

You could use present?, which acts as a sort of !blank?

William
A: 

you could use defined? as well

apnea.diving.deep