Is there a Ruby, or Ruby-ism for not_nil? opposite of nil? method?

I am not experienced in Ruby, so my code feels "ugly" and not idiomatic:

def logged_in?
  !user.nil?
end

I'd rather have something like

def logged_in?
  user.not_nil?
end

But cannot find such a method that opposites nil?

81
задан berkes 12 January 2016 в 15:03
поделиться