Class: NilClass

Inherits:
Object show all
Defined in:
lib/not_nilable/core_ext/nil_class.rb

Instance Method Summary collapse

Instance Method Details

#not_nil!(message = nil) ⇒ Object

Raises NotNilable::NilAssertionError.

This method asserts that the receiver is not nil. Since the receiver is nil, the assertion fails and an exception is raised. An optional message may be supplied to customize the exception message.



11
12
13
# File 'lib/not_nilable/core_ext/nil_class.rb', line 11

def not_nil!(message = nil) #: bot
  raise NotNilable::NilAssertionError, message || "Nil assertion failed"
end