class NilClass
def as_json(options = nil) #:nodoc:
def as_json(options = nil) #:nodoc: self end
def blank?
-
(true)
-
def blank? true end
def to_param
def to_param self end
def try(method_name = nil, *args)
With +try+
@person && @person.children.any? && @person.children.first.name
Without +try+
nil.try(:name) # => nil
It becomes especially helpful when navigating through associations that may return +nil+.
Calling +try+ on +nil+ always returns +nil+.
def try(method_name = nil, *args) nil end
def try!(method_name = nil, *args)
Calling +try!+ on +nil+ always returns +nil+.
def try!(method_name = nil, *args) nil end