struct
RemiLib::RSConf::RSScalar
- RemiLib::RSConf::RSScalar
- Struct
- Value
- Object
Overview
RSScalar wraps a scalar value in RSConf. Scalar values are integers,
floats, booleans, strings, or the null value.
Defined in:
remilib/rsconf/common.crConstructors
-
.new(value : Int)
Creates a new
RSScalarinstance. -
.new(value : Float32 | Float64)
Creates a new
RSScalarinstance. -
.new(value : Bool)
Creates a new
RSScalarinstance. -
.new(value : String)
Creates a new
RSScalarinstance. -
.new(value : Nil)
Creates a new
RSScalarinstance.
Instance Method Summary
-
#bool : Bool
Returns the scalar value that has the type
Bool. - #bool? : Bool | Nil
-
#float : Float64
Returns the scalar value that has the type
Float64. -
#float! : Float64
Returns the scalar value that has the type
Float64. -
#float? : Float64 | Nil
Returns the scalar value that has the type
Float64|Nil. -
#int : RSInteger
Returns the scalar value that has the type
RSInteger. -
#int! : RSInteger
Returns the scalar value that has the type
RSInteger. - #int? : RSInteger | Nil
-
#isBool? : Bool
Returns
trueif this instance contains a scalar of the typeBool, orfalseotherwise. -
#isFloat? : Bool
Returns
trueif this instance contains a scalar of the typeFloat64, orfalseotherwise. -
#isFloatable? : Bool
Returns
trueif this scalar holds an integer or float value, orfalseotherwise. -
#isInt? : Bool
Returns
trueif this instance contains a scalar of the typeRSInteger, orfalseotherwise. -
#isIntable? : Bool
Returns
trueif this scalar holds an integer or float value, orfalseotherwise. -
#isNil? : Bool
Returns
trueif this scalar holds the null value, orfalseotherwise. -
#isString? : Bool
Returns
trueif this instance contains a scalar of the typeString, orfalseotherwise. -
#string : String
Returns the scalar value that has the type
String. -
#string! : String
Returns this scalar value as a string.
- #string? : String | Nil
-
#toRsconf(builder : RemiLib::RSConf::Builder)
Converts this instance to RSConf data by writing data using builder.
-
#tryFloat : Float64 | Nil
Attempts to return the scalar value that has the type
Float64. -
#tryInt : RSInteger | Nil
Attempts to return the scalar value that has the type
RSInteger. -
#val : RSInteger | Float64 | Bool | String | Nil
Returns the value of this scalar.
Instance methods inherited from class Object
toRsconf(io : IO, *, indentSize : Int = 2, alwaysQuoteKeys : Bool = false, explicitRootObject : Bool = false, commaAfterValues : Bool = false, extraNewlineBetweenToplevelKeys : Bool = false) : NiltoRsconf(*, indentSize : Int = 2, alwaysQuoteKeys : Bool = false, explicitRootObject : Bool = false, commaAfterValues : Bool = false, extraNewlineBetweenToplevelKeys : Bool = false) : String toRsconf
Class methods inherited from class Object
fromRsconf(toplevel : RemiLib::RSConf::RSValue)fromRsconf(data : String | IO | Path) fromRsconf
Constructor Detail
Instance Method Detail
Returns the scalar value that has the type Bool. If
this instance does not hold the correct type, an exception is raised.
Returns the scalar value that has the type Bool|Nil. If
this instance does not hold the correct type, an exception is raised.
Returns the scalar value that has the type Float64. If
this instance does not hold the correct type, an exception is raised.
Returns the scalar value that has the type Float64. If this instance
does not hold either an integer or float, an exception is raised. If this
holds an integer, it is converted to Float64 using to_f64!.
Returns the scalar value that has the type Float64|Nil. If
this instance does not hold the correct type, an exception is raised.
Returns the scalar value that has the type RSInteger. If
this instance does not hold the correct type, an exception is raised.
Returns the scalar value that has the type RSInteger. If this instance
does not hold either an integer or float, an exception is raised. If this
holds a float, it is converted to RSInteger using to_128!.
Returns the scalar value that has the type RSInteger|Nil. If
this instance does not hold the correct type, an exception is raised.
Returns true if this instance contains a scalar of the type
Bool, or false otherwise.
Returns true if this instance contains a scalar of the type
Float64, or false otherwise.
Returns true if this scalar holds an integer or float value, or false
otherwise.
Returns true if this instance contains a scalar of the type
RSInteger, or false otherwise.
Returns true if this scalar holds an integer or float value, or false
otherwise.
Returns true if this scalar holds the null value, or false otherwise.
Returns true if this instance contains a scalar of the type
String, or false otherwise.
Returns the scalar value that has the type String. If
this instance does not hold the correct type, an exception is raised.
Returns this scalar value as a string. Non-string values will be
converted to string using #to_s.
Returns the scalar value that has the type String|Nil. If
this instance does not hold the correct type, an exception is raised.
Converts this instance to RSConf data by writing data using builder.
Attempts to return the scalar value that has the type Float64. If this
instance does not hold a float, this returns nil.
This is not the same as a scalar that holds a float or a null value. For
that, use #float?.