Assert::Assertions::NotNil(PropertyType)
Inherits Assert::Assertions::Assertion / Reference / Object
Validates a property is not nil.
Example
class Example
include Assert
def initialize; end
@[Assert::NotNil]
property nilable_int : Int32? = 17
@[Assert::NotNil]
property nilable_string : String? = "Bob"
end
Example.new.valid? # => true
Constructors
new(property_name : String, actual : PropertyType, message : String | Nil = nil, groups : Array(String) | Nil = nil)
SourceInstance methods
default_message_template
Returns the default #message_template to use if no message is provided.
message
The message to display if self is not valid.
NOTE: This method is defined automatically, and is just present for documentation purposes.