class CrSerializer::Assertions::NotNilAssertion(ActualValueType)

Overview

Validates a property is not nil

Usable on all data types

@[Assert::NotNil]
property name : String

Defined in:

CrSerializer/assertions/not_nil.cr

Constructors

Instance Method Summary

Instance methods inherited from class CrSerializer::Assertions::Assertion

error_message : String error_message, field : String field, valid? : Bool valid?

Constructor methods inherited from class CrSerializer::Assertions::Assertion

new(field : String, message : String | Nil) new

Instance methods inherited from class Object

to_json(json : JSON::Builder, groups : Array(String) = ["default"]) to_json

Constructor methods inherited from class Object

deserialize(json : String) : self deserialize

Constructor Detail

def self.new(field : String, message : String | Nil, actual : ActualValueType) #

[View source]

Instance Method Detail

def actual #

The current value of the property


def error_message : String #

The message that will be shown if the assertion is not valid


[View source]
def valid? : Bool #
Description copied from class CrSerializer::Assertions::Assertion

Returns true if the provided property passes the assertion, otherwise false.

TODO make this abstract once this issue is resolved.


[View source]