abstract class Ven::Suite::MClass
- Ven::Suite::MClass
- Reference
- Object
Overview
The parent of all Model
s that are represented by a Crystal
class; often Models that have no particular value.
Direct Known Subclasses
- Ven::Suite::MAny
- Ven::Suite::MBoxInstance
- Ven::Suite::MFunction
- Ven::Suite::MType
- Ven::Suite::MVector
Defined in:
ven/suite/model.crInstance Method Summary
-
#[]=(referent : Model, value : Model) : Model | Nil
Sets this model's referent item (whatever the meaning of that is) to value.
-
#[]?(index : Int)
Returns index-th item of this model.
-
#[]?(index : Range)
Returns a subset of items in this model.
-
#callable? : Bool
Returns whether this model is callable.
-
#eqv?(other : Model) : Bool
Returns whether this model is equal-by-value to the other model.
-
#false? : Bool
Returns whether this model is a false
MBool
. -
#field(name : String) : Model | Nil
Returns a field's value for this model, or nil if this model has no such field.
-
#indexable?
Returns whether this model is indexable (i.e., properly implements
#nth
). -
#length : Int32
Returns the length (#) of this model.
-
#match(other : Model)
Returns whether this model is of the type other, or is equal-by-value to other.
-
#nth(index : Num)
Returns the index-th item of this model,
-
#nth(range : MRange)
Returns a subset of items in this model.
-
#nth(other)
Returns a subset of items in this model.
-
#of?(other : MType) : Bool
Returns whether this model is of the type other.
-
#of?(other : MAny)
Returns whether this model is of the type other.
-
#of?(other)
Returns whether this model is of the type other.
-
#set_referent(referent : Model, value : Model) : Model
Sets this model's referent item (whatever the meaning of that is) to value.
-
#to_bool(inverse = false) : MBool
Converts (casts) this model into an
MBool
. -
#to_num : Num
Converts (casts) this model into a
Num
. -
#to_str : Str
Converts (casts) this model into a
Str
. -
#to_vec : Vec
Converts (casts) this model into a
Vec
. -
#true? : Bool
Returns whether this model is semantically true.
-
#weight : MWeight
Returns the weight (see
MWeight
) of this model.
Instance Method Detail
Sets this model's referent item (whatever the meaning of that is) to value.
Models may choose to override this method.
Returns nil if found no referent item (this is the default meaning; it may be changed by the overriding model).
Returns index-th item of this model.
Subclasses should rather override this method instead
of #nth
.
Returns a subset of items in this model.
Subclasses should rather override this method instead
of #nth
.
Returns whether this model is equal-by-value to the other model.
Returns a field's value for this model, or nil if this model has no such field.
Returns whether this model is of the type other, or is equal-by-value to other.
Returns the index-th item of this model,
Subclasses should not generally override this method.
They should override #[]?
instead.
Raises ModelCastException
if index is improper.
Returns a subset of items in this model.
Subclasses should not generally override this method.
They should override #[]?
instead.
Raises ModelCastException
if index is improper.
Returns a subset of items in this model.
Subclasses should not generally override this method.
They should override #[]?
instead.
Raises ModelCastException
if index is improper.
Sets this model's referent item (whatever the meaning of that is) to value.
Generally, subclasses should not choose to override
this method. They can override #[]=
instead.
Converts (casts) this model into an MBool
. Inverts
this MBool (applies not
) if inverse is true.