abstract struct Ven::Suite::MStruct

Overview

The parent of all Models represented by a Crystal struct.

Direct Known Subclasses

Defined in:

ven/suite/model.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def callable? : Bool #

Returns whether this model is callable.


[View source]
def eqv?(other : Model) : Bool #

Returns whether this model is equal-by-value to the other model.


[View source]
def field(name : String) : Model | Nil #

Returns a field's value for this model (or nil if the field of interest does not exist).


[View source]
def initialize #

[View source]
def is_bool_false? : Bool #

Returns whether this is a false MBool.


[View source]
def of?(other : MType) : Bool #

Returns whether this model is of the type other.


[View source]
def of?(other) #

Returns whether this model is of the type other.


[View source]
def to_bool(inverse = false) : MBool #

Converts (casts) this model into an MBool. Inverts this MBool (applies not) if inverse is true.


[View source]
def to_num : Num #

Converts (casts) this model into a Num.


[View source]
def to_str : Str #

Converts (casts) this model into a Str.


[View source]
def to_vec : Vec #

Converts (casts) this model into a Vec.


[View source]
def true? : Bool #

Returns whether this model is semantically true.


[View source]
def truth=(truth : Bool) #

Temporarily assigns the truth to truth.


[View source]
def truth? #

Returns whether this model was yielded by a truthy expression: false is false => false but is truthy, etc. Recomputes via #true? right away.


[View source]