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
-
#[]?(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.
-
#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
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.
Converts (casts) this model into an MBool
. Inverts
this MBool (applies not
) if inverse is true.