Module: Kernel

Defined in:
lib/type_toolkit/ext/nil_assertions.rb

Overview

Asserts that the receiver is not nil.

You should use not_nil! in places where you're absolutely sure a nil value can't occur. This should be done as closely to where the value is created as possible, so that the nil value doesn't have a chance to be passed around the system. This way, failures occur close to the source of the problem, and are easier to fix.

Instance Method Summary collapse

Instance Method Details

#not_nil!Object

Signature:

  • -> self



12
13
14
# File 'lib/type_toolkit/ext/nil_assertions.rb', line 12

def not_nil!
  self
end