class

UCL::Decoder

Inherits Reference < Object

Converts a parsed libucl object tree into native Crystal values.

Backs UCL.load. Repeated keys are always decoded as explicit arrays: the decoder forces UCL_PARSER_NO_IMPLICIT_ARRAYS on top of the caller's flags (see decode), because libucl's implicit-array iteration flattens repeated object values and cannot be reconstructed faithfully here.

Class methods

decode(string : String, flags = UCL::Parser::DEFAULT_FLAGS) : UCL::Value::Type

Parses string and returns the decoded Crystal value.

UCL_PARSER_NO_IMPLICIT_ARRAYS is always OR-ed into flags so that repeated keys — scalars and objects — decode to Crystal arrays instead of being merged/lost.

Raises UCL::Error::DecoderError on a parse error and UCL::Error::ConversionError on an unsupported libucl type.

Source
decode_file(path : String, flags = UCL::Parser::DEFAULT_FLAGS) : UCL::Value::Type

Loads and decodes the UCL file at path. Same flag handling and ownership contract as .decode.

Raises UCL::Error::DecoderError if the file cannot be read or parsed.

Source