class

Hwaro::Assets::Sass::Number

Inherits Hwaro::Assets::Sass::Value / Reference / Object

Constructors

new(value : Float64, unit : String = "", lexeme : String | Nil = nil)
Source

Class methods

format(value : Float64) : String

dart-sass-style number formatting: integers without a decimal point, floats rounded to 10 digits with trailing zeros trimmed.

Never routes through Float64#to_s, which switches to exponent form outside roughly [1e-4, 1e16). CSS has no exponent syntax and no Infinity/NaN literals, so 3.33333e-5px is not a number a browser can read — it drops the whole declaration. Small values are reachable from ordinary ratio math (opacity, scale).

Source

Instance methods

compatible_unit?(other : Number) : Bool

v1 unit model: identical units or one side unitless. No px↔cm-style conversions.

Source
eq?(other : Value) : Bool

Sass equality (==). Subclasses override; default is identity on serialized text.

Source
int_value(context : String) : Int32
Source
lexeme

Original source spelling (".5em"); kept so uncomputed numbers serialize byte-identically.

Source
result_unit(other : Number) : String
Source
to_css

CSS text for this value (what lands in output).

Source
unit
Source
value
Source