Repository navigation
v0.1.0
·
10 commits
to master
since this release
Added
- Initial Release: First public version of the
ctongem. - CTON Encoder:
Cton.dump(aliased asCton.generate) to convert a RubyHashinto a CTON string.- Encodes objects, arrays, strings, numbers, booleans, and
nil. - Automatic table detection for arrays of uniform hashes, creating a highly compact representation:
key[N]{h1,h2}=v1,v2;.... - Smart string quoting: only quotes strings containing special characters, whitespace, or those that could be misinterpreted as numbers, booleans, or null.
- Number normalization: canonicalizes floats and
BigDecimalto a clean, exponent-free format.NaNandInfinityare converted tonullfor safety. - Configurable separator (
\nby default) between top-level key-value pairs.
- Encodes objects, arrays, strings, numbers, booleans, and
- CTON Decoder:
Cton.load(aliased asCton.parse) to parse a CTON string back into a Ruby object.- Handles all CTON structures: objects
(), arrays[], and compact tables[]{}. - Supports an optional
symbolize_names: trueargument to convert all hash keys to symbols. - Robust parsing of scalars, including quoted and unquoted strings.
- Handles all CTON structures: objects
- Error Handling:
Cton::EncodeErrorfor unsupported Ruby types during encoding andCton::ParseErrorfor malformed CTON input. - Documentation:
README.mdwith a format overview, usage examples, and rationale. - Testing: Comprehensive RSpec suite ensuring round-trip integrity and correct handling of edge cases.