module

TOML::ValueDecoder

Decoders that turn raw atom/string text into typed Values.

Kept in a dedicated module so the parser stays focused on structural concerns. All decoders raise TOML::ParseError (with 1-based line/column) on invalid input.

Instance methods

decode_basic_string(raw : String, line : Int32, column : Int32) : StringValue

Decodes a BasicString token (raw still includes the surrounding " quotes) into a StringValue.

Source
decode_float(raw : String) : FloatValue | Nil

Build a FloatValue from the textual form int_part . frac_part or with an exponent. Used by the parser when it has reassembled the parts that the lexer emitted as Atom Dot Atom.

Source
decode_literal_string(raw : String, _line : Int32, _column : Int32) : StringValue
Source
decode_multiline_basic_string(raw : String, line : Int32, column : Int32) : StringValue
Source
decode_multiline_literal_string(raw : String, _line : Int32, _column : Int32) : StringValue
Source
try_decode_atom(raw : String) : Value | Nil

Try to decode an atom as an integer, float, boolean, or special float (inf, nan, +inf, -inf, +nan, -nan). Returns nil if raw is none of these so the caller can try other interpretations (datetime, dotted-key segment, …).

Source
try_decode_datetime(raw : String) : Value | Nil

Try to decode raw as one of the four TOML date/time variants: OffsetDateTime, LocalDateTime, LocalDate, LocalTime. Returns nil if raw does not match any of these shapes so the caller can keep trying integer/float interpretations.

Accepts both T/t and a literal space as the date/time delimiter (per TOML 1.0). The lexer emits a space-separated form as separate tokens, so this method only sees T/t forms and the space variant must be reassembled by the parser.

Source