Class: Object

Inherits:
BasicObject
Defined in:
lib/code-assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_not_nil!Object Also known as: assert_nn!



35
36
37
# File 'lib/code-assertions.rb', line 35

def assert_not_nil!
    assert("The result cannot be `nil` or `false`.") { self }
end

#assert_type!(type) ⇒ Object Also known as: at!



40
41
42
43
# File 'lib/code-assertions.rb', line 40

def assert_type!(type)
    assert("`type` should be an instance of `Class`") { type.is_a?(Class) }
    assert("Wrong type: expected #{type.name}, given #{self.class.name}") { self.is_a?(type) }
end