Toml
Inherits from: Object
Parse and generate TOML (Tom's Obvious Minimal Language) documents.
All methods are class-side — Toml is never instantiated.
Type mapping: TOML table <-> Dictionary TOML array <-> Array TOML string <-> String TOML integer <-> SmallInteger TOML float <-> Float TOML boolean <-> True / False TOML datetime <-> String (ISO 8601) TOML array of tables <-> Array of Dictionaries
Malformed input raises TomlParseError with line/column info.
Example
"Parse a TOML string"
| config <Dictionary> |
config := Toml decode: '[server]
host = "localhost"
port = 8080'.
(config at: 'server') at: 'host'
Example
"Encode a Dictionary as TOML"
| d <Dictionary> |
d := Dictionary new.
d at: 'name' put: 'my-app'.
d at: 'version' put: '1.0.0'.
Toml encode: d
Example
"Read a TOML file"
| config <Dictionary> |
config := Toml decodeFile: 'config.toml'.
config at: 'database'
Class Methods
primitives
class decode:
class decodeFile:
class encode: