struct Ven::Suite::MRange
- Ven::Suite::MRange
- Ven::Suite::MStruct
- Struct
- Value
- Object
Overview
Ven's range data type.
Defined in:
ven/suite/model.crConstant Summary
-
RANGE_SAFE_CAP =
100000
-
Maximum amount of values a range can include.
Constructors
Instance Method Summary
-
#[]?(index : Int)
Returns index-th item of this model.
- #end : Num
- #eqv?(other : MRange)
- #field(name)
-
#includes?(num : BigDecimal)
Returns whether this range includes num.
-
#indexable?
Returns whether this model is indexable (i.e., properly implements
nth
). -
#length
Returns the length (#) of this model.
- #start : Num
- #to_s(io)
-
#to_vec
Computes this range.
Instance methods inherited from struct Ven::Suite::MStruct
[]=(referent : Model, value : Model) : Model | Nil
[]=,
[]?(index : Int)[]?(index : Range) []?, callable? : Bool callable?, eqv?(other : Model) : Bool eqv?, false? : Bool false?, field(name : String) : Model | Nil field, indexable? indexable?, initialize initialize, length : Int32 length, match(other : Model) match, nth(index : Num)
nth(range : MRange)
nth(other) nth, of?(other : MType) : Bool
of?(other : MAny)
of?(other) of?, set_referent(referent : Model, value : Model) : Model set_referent, to_bool(inverse = false) : MBool to_bool, to_num : Num to_num, to_str : Str to_str, to_vec : Vec to_vec, true? : Bool true?, weight : MWeight weight
Constructor methods inherited from struct Ven::Suite::MStruct
new
new
Constructor Detail
Instance Method Detail
def []?(index : Int)
#
Description copied from struct Ven::Suite::MStruct
Returns index-th item of this model.
Subclasses should rather override this method instead
of nth
.
def indexable?
#
Description copied from struct Ven::Suite::MStruct
Returns whether this model is indexable (i.e., properly
implements nth
).
def length
#
Description copied from struct Ven::Suite::MStruct
Returns the length (#) of this model.
def to_vec
#
Computes this range.
Will raise ModelCastException if this range is too large
(see RANGE_SAFE_CAP
).