abstract class CrSerializer::Assertions::Assertion

Overview

Base class of all assertions

Sets the field ivar and message if no message was provided

Direct Known Subclasses

Defined in:

CrSerializer/assertions/assertion.cr

Constructors

Instance Method Summary

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) #

[View source]

Instance Method Detail

def error_message : String #

Message to display when validation fails.

TODO make this abstract once this issue is resolved.


[View source]
def field : String #

The property that the assertion is tested against


[View source]
def valid? : Bool #

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

TODO make this abstract once this issue is resolved.


[View source]