A summary of data about the Ruby ecosystem.

Recent Releases of https://github.com/emancu/toml-rb

https://github.com/emancu/toml-rb - v6.0.0: pure Ruby, no dependencies

toml-rb 6.0.0 is pure Ruby, and it has no runtime dependencies πŸŽ‰

A new parser on the StringScanner class of the Ruby standard library replaces the Citrus grammar. gem install toml-rb now installs one gem, and require "toml-rb" loads only toml-rb.

60 to 90 times faster πŸš€

Document 5.0.0 6.0.0 Speedup
example.toml (0.8 KB) 4.5 ms 67.2 Β΅s 67Γ—
Lock file (100 KB) 506.9 ms 5.9 ms 86Γ—
Lock file (1 MB) 5.43 s 60.5 ms 90Γ—

These numbers are the CPU time for one TomlRB.parse call on Ruby 3.4.1 (Apple M3 Pro). With YJIT, the 1 MB file parses 199 times faster than on 5.0.0.

TomlRB.dump is faster too. A 3.3 MB lock file dumps 45 times faster than before.

benchmark/README.md has all the results, with Ruby 4.0.7, YJIT, ZJIT, tomlrb, perfect_toml and tomlib.

The same results

  • The new parser gives the same data as 5.0.0 on 9,257 real-world TOML files: Cargo, uv, Poetry, Hugo, Julia and more. Only the local datetimes change (see below).
  • toml-rb still passes all toml-test v2.2.0 decoder tests for TOML 1.1.0.
  • CI runs on MRI 2.5 to 4.0, JRuby and TruffleRuby.

Better error messages

A syntax error now gives the line, the column and the expected text:

Unexpected "e" at line 1, column 9: expected ']'

Before you upgrade

  • Code that matches the old error message text must change.
  • TomlRB::LocalDateTime and TomlRB::LocalDate are now UTC Time values, like TomlRB::LocalTime. Their clock time matches the TOML text in every time zone, also inside a daylight saving time gap. Compare them with Time.utc, not Time.local.
  • More than 100 nested levels of arrays and inline tables raise TomlRB::ParseError.
  • This release removes the Citrus grammar constants, like TomlRB::Document.

CHANGELOG.md lists every change.

Full Changelog: https://github.com/emancu/toml-rb/compare/v5.0.0...v6.0.0

- Ruby
Published by emancu about 2 months ago

https://github.com/emancu/toml-rb - v5.0.0

Breaking changes

  • parse returns TomlRB::LocalDateTime, TomlRB::LocalDate and
    TomlRB::LocalTime for local values. Each is a Time subclass: is_a?(Time)
    stays true and instance_of?(Time) is false. Offset datetimes stay Time.
    Use Time.at(value) for a plain Time. (#183)
  • A local time is a UTC Time on 1970-01-01, at the same instant as in v4.
    hour, min and sec match the TOML text in all zones. to_s, zone and
    utc? can change. (#183)
  • dump writes local values without offsets: 1979-05-27, 07:32:00 or
    1979-05-27T07:32:00. Before, it wrote datetimes with Z. (#183)
  • dump writes the UTC offset of a Time or DateTime and up to 9 fractional
    digits, with no final zeros. Before, it wrote the clock time with Z and no
    fraction. (#183, #193)
  • parse keeps exact fractions: .123 gives nsec 123000000. A Time built
    from Float seconds is not equal, and dumps with the Float error. Build the
    Time from a Rational. (#193)
  • Leading zeros, out-of-range dates, times and offsets, comma fractions, [,]
    and two statements per line raise TomlRB::ParseError. (#196, #199)
  • a=[12:00:00,5] now has two elements: a local time and an integer. (#199)
  • Duplicate tables or tables that headers and dotted keys both extend now raise
    TomlRB::ValueOverwriteError (toml-lang/toml#859). Some parsed before. (#197)
  • Invalid input raises TomlRB::Error or a subclass instead of NoMethodError,
    TypeError or ArgumentError. Use rescue TomlRB::Error. (#197, #199, #202)
  • Some valid multi-line strings change value to match the spec. Indentation
    and blank lines after the first newline stay. Multi-line literal strings keep
    backslashes at line ends. \\ before a newline escapes a backslash. (#203)
  • The escape \0, invalid \u and \U code points, and more than two quotes
    before a multi-line end delimiter raise TomlRB::ParseError. (#203)
  • Control characters in strings and comments raise TomlRB::ParseError. Tabs
    stay valid. Multi-line strings accept LF and CRLF newlines. (#204)
  • dump raises TomlRB::Error for nil, Rational, Complex, Set, Struct, other
    objects and non-finite BigDecimal. Before, it wrote Ruby inspect output.
    Remove nil values before dump. (#202)
  • symbolize_keys: true also applies to inline tables inside arrays:
    a = [{b = 1}] gives {a: [{b: 1}]}. Before, b stayed a String key.
    parse can raise a different error for a document with many errors. (#209)

TOML 1.1.0

  • Basic strings accept \e for ESC. dump still writes \u001B. (#181)
  • Basic strings accept \xHH code points, not bytes ("\xff" is "ΓΏ"). (#182)
  • Seconds are optional in times and datetimes. (#184)
  • Fractions can exceed 6 digits. toml-rb keeps 9 and truncates the rest. (#193)
  • toml-rb passes all toml-test v2.2.0 decoder tests for TOML 1.1.0. (#180)

Fixes

  • ["a.b"] and [a.b] define separate tables. (#197)
  • Inline tables accept shared dotted key prefixes. (#197)
  • Datetimes accept lowercase t and z. (#199)
  • Spaces and tabs alone give {}. Arrays accept comments before commas. (#196)
  • Multi-line basic strings accept spaces and tabs after a final backslash.
    Escaped quotes do not close these strings. (#203)
  • dump accepts a hash with String and Symbol keys. Two keys with the same
    string form, like "a" and :a, raise TomlRB::Error. (#202)
  • dump writes Symbol values as strings and Regexp with string escapes. (#202)
  • dump uses inline tables for hashes in mixed or nested arrays. (#202)
  • load_file reads files as UTF-8, also under LANG=C. (#207)
  • The gem no longer depends on racc. (#205)

Known limitations

  • In the system time zone, a DST gap moves local datetimes later, as in v4.
  • A YAML round trip or ActiveSupport change and advance turn a local value
    into a plain Time, so dump writes an offset datetime.
  • dump truncates UTC offsets with seconds to whole minutes.
  • toml-rb always accepts TOML 1.1.0 syntax. No option selects TOML 1.0.0, so 9
    toml-test 1.0.0 tests that expect an error do not pass.
  • Deep arrays or inline tables raise SystemStackError, not TomlRB::Error.

- Ruby
Published by emancu about 2 months ago

https://github.com/emancu/toml-rb - v5.0.0.rc.1

Breaking changes

  • TomlRB.parse returns TomlRB::LocalDateTime, TomlRB::LocalDate and
    TomlRB::LocalTime for local datetimes, local dates and local times. Each
    class is a subclass of Time. Offset datetimes stay Time. For a local
    value, instance_of?(Time) and .class == Time are false, but
    is_a?(Time) and when Time match. Use Time.at(value) to get a plain
    Time, because value.to_time returns value. (#183)
  • A local time is a UTC Time on 1970-01-01, at the same instant as before.
    Its hour, min and sec now match the TOML text in every system time
    zone. to_s, zone, utc?, to_date, wday and yday can return other
    values. (#183)
  • TomlRB.dump writes the UTC offset and the fractional seconds of a Time or
    a DateTime, with up to 9 digits. Before, it wrote the clock time of the
    value with a Z suffix and no fraction. For example,
    TomlRB.dump(t: Time.now) now writes the offset of the system time zone
    and up to 9 fractional digits. The dumper removes zeros at the end of the
    fraction, so Time.at(0, 123456780, :nanosecond).utc dumps as
    1970-01-01T00:00:00.12345678Z. (#183, #193)
  • A Time built from Float seconds dumps with the binary error of the Float:
    Time.utc(1979, 5, 27, 7, 32, 0.999999) dumps as
    1979-05-27T07:32:00.999998999Z. Build the Time from a Rational to get
    exact digits. (#193)
  • TomlRB.dump writes a TomlRB::LocalDateTime without an offset, a
    TomlRB::LocalDate as YYYY-MM-DD, and a TomlRB::LocalTime as
    HH:MM:SS, with a fraction when the value has one. Before, each local value
    dumped as an offset datetime with a Z suffix. (#183)
  • Offset datetimes keep exact fractional seconds: .123 gives nsec
    123000000, not 122999999. So a parsed value is not equal to a Time built
    from Float seconds. Build the expected Time from a Rational, for example
    Rational(123, 1000). (#193)
  • These documents raise TomlRB::ParseError (#199):
    • Integers and floats with leading zeros, like 0123 and 00.5. Before,
      they parsed as 123 and 0.5.
    • Dates, times and offsets out of range, like 2025-02-30, 25:00:00,
      07:32:61 and +24:00. Before, some values became a later date or time
      (2025-02-30 became 2025-03-02), and others raised ArgumentError.
    • A comma before the fractional seconds, like 07:32:00,5.
  • a=[12:00:00,5] is now an array of the local time 12:00:00 and the
    integer 5. Before, it was an array of one time with the fraction .5.
    The document parses in both versions, so no error shows the change. (#199)
  • Two statements on one line raise TomlRB::ParseError, like a=1 b=2 and
    [a] b=2. An array with a comma and no element, [,], also raises it.
    Before, these documents parsed. (#196)
  • These invalid documents parsed before, and now raise
    TomlRB::ValueOverwriteError (#197):
    • "[ab]\n[[a]]\n[ab]"
    • "x = false\n[[x]]"
    • "a = []\n[[a]]"
    • "[a.b]\n[a]\nb = {c = 1}"
    • A header inside an inline table or a static array, like
      "a = {b = 1}\n[a.c]".
    • A header for a table that dotted keys made, like "a.b = 1\n[a]" and
      "[fruit]\napple.color = \"red\"\n[fruit.apple]" (toml-lang/toml#859).
    • Dotted keys that extend a table that a header defined, like
      "[a.b]\n[a]\nb.c=1" (toml-lang/toml#859).
  • These invalid documents raise TomlRB::ValueOverwriteError instead of
    another error. rescue TomlRB::Error catches TomlRB::ValueOverwriteError
    and TomlRB::ParseError. (#197)
    • "a = true\n[[a]]": was NoMethodError.
    • "a = 1\n[[a.b]]" and "a = 1\na.b = {}": was TypeError.
    • "inline-t = {nest = {}}\n[[inline-t.nest]]": was TomlRB::ParseError.
  • Some valid multi-line strings change value. The new value is the value that
    the spec requires (#203):
    • Indentation and blank lines after the opening newline stay.
    • In a multi-line literal string, a backslash at the end of a line stays.
    • \\ before a newline is an escaped backslash, not a line-ending backslash.
  • These strings raise TomlRB::ParseError (#203):
    • The escape \0, which TOML does not define.
    • A \u or \U escape that is not a Unicode scalar value: \uD800 to
      \uDFFF, and \U00110000 and higher.
    • More than two quotes directly before the closing delimiter of a multi-line
      string, like """x"""""".
  • Control characters in strings and comments raise TomlRB::ParseError:
    U+0000 to U+0008, U+000A to U+001F and U+007F. Tab stays valid, and a
    multi-line string can contain LF and CRLF newlines. (#204)
  • TomlRB.dump raises TomlRB::Error for nil and for values without a TOML
    form: Rational, Complex, Set, Struct, other objects, and BigDecimal NaN or
    Infinity. Before, it wrote Ruby inspect output, which is not TOML. Remove
    nil values before the dump, because TOML has no null. A finite BigDecimal
    dumps as before, like 0.15e1. (#202)
  • TomlRB.dump raises TomlRB::Error when two keys have the same string form,
    like "a" and :a. Before, it raised ArgumentError. (#202)

TOML 1.1.0

  • Basic and multi-line basic strings accept the \e escape for ESC (U+001B).
    The dumper still writes ESC as \u001B, which is valid TOML 1.0.0. (#181)
  • Basic and multi-line basic strings accept the \xHH escape for the code
    point U+00HH, not a byte: "\xff" is "ΓΏ". (#182)
  • Seconds are optional in times and datetimes, like 10:30 and
    1979-05-27T07:32Z. (#184)
  • Fractional seconds can have more than 6 digits. toml-rb keeps 9 digits and
    truncates the rest. (#193)
  • Headers and dotted keys follow toml-lang/toml#859. See Breaking changes.
    (#197)
  • toml-rb passes all toml-test v2.2.0 decoder tests for TOML 1.1.0. (#180)

Fixes

  • ["a.b"] and [a.b] in one document are two tables. Before, they raised
    TomlRB::ValueOverwriteError. (#197)
  • a = {b.c = 1, b.d = 2} parses. (#197)
  • Datetimes accept a lowercase t and z. (#199)
  • A document with only spaces and tabs, and no line break, returns {}. (#196)
  • An array accepts a comment before a comma. (#196)
  • A multi-line basic string accepts spaces and tabs between a line-ending
    backslash and the newline. (#203)
  • An escaped quote does not close a multi-line basic string, for example in
    """a\""" b""". (#203)
  • TomlRB.dump accepts a hash with String and Symbol keys. (#202)
  • TomlRB.dump writes a hash inside a mixed or nested array as an inline
    table: TomlRB.dump(a: [1, {b: 1}]) gives a = [1, {b = 1}]. Before, it
    wrote Ruby inspect output. For a mixed array with a hash as the first
    element, like [{b: 1}, 2], it raised NoMethodError. An array of only
    hashes still dumps as an array of tables ([[a]]). (#202)
  • TomlRB.dump writes a Symbol value as a string and a Regexp with the string
    escapes. Before, it wrote Ruby inspect output. (#202)
  • TomlRB.load_file reads the file as UTF-8. Before, it used the default
    external encoding, and under LANG=C it raised TomlRB::ParseError for
    non-ASCII text. (#207)
  • symbolize_keys: true applies to inline tables inside arrays. For a
    document with more than one error, TomlRB.parse can raise a different one
    of them. (#209)
  • The gem no longer depends on racc. racc is a native extension, and toml-rb
    does not load it. (#205)

Known limitations

  • A local datetime inside a daylight saving time (DST) gap of the system time
    zone changes to a later time. For example, 2026-03-29T02:30:00 in
    Europe/Warsaw becomes 03:30. v4 has the same behavior.
  • Psych YAML.load(YAML.dump(v), permitted_classes: [Time]) and ActiveSupport
    change and advance return a plain Time. So TomlRB.dump writes the
    result as an offset datetime.
  • TomlRB.dump truncates a UTC offset with seconds to whole minutes. For
    example, the local mean time offset +00:19:32 becomes +00:19.
  • The TOML 1.0.0 skip-list has 9 tests. toml-rb accepts TOML 1.1.0 syntax and
    has no option to select the spec version, so it does not reject these TOML
    1.0.0 documents.
  • Very deep arrays or inline tables raise SystemStackError, not a
    TomlRB::Error. On Ruby 3.4.1 with the default stack size, 500 nested levels
    raise it.

- Ruby
Published by emancu about 2 months ago

https://github.com/emancu/toml-rb - v4.2.2

  • Security: the regular expressions for strings and comments backtracked in
    exponential or quadratic time. A short document could cause a denial of
    service. The rules now match in linear time. See
    GHSA-v667-mm43-5q7r.
    (#195)
  • Some documents parsed wrongly and now follow the spec: a="x\" and
    a='x\'y' raise TomlRB::ParseError, a=['C:\', 'D:\'] parses, and
    a='C:\' # ' gives "C:\\" and a comment. (#195)

- Ruby
Published by emancu about 2 months ago

https://github.com/emancu/toml-rb - v4.2.1

What's Changed

New Contributors

Full Changelog: https://github.com/emancu/toml-rb/compare/v4.2.0...v4.2.1

- Ruby
Published by emancu 4 months ago

https://github.com/emancu/toml-rb - v4.2.0

What's Changed

Full Changelog: https://github.com/emancu/toml-rb/compare/v4.1.0...v4.2.0

- Ruby
Published by emancu 7 months ago

https://github.com/emancu/toml-rb - v4.1.0

What's Changed

Full Changelog: https://github.com/emancu/toml-rb/compare/v4.0.0...v4.1.0

- Ruby
Published by emancu about 1 year ago

https://github.com/emancu/toml-rb - v4.0.0

What's Changed

Full Changelog: https://github.com/emancu/toml-rb/compare/v3.0.1...v4.0.0

- Ruby
Published by emancu over 1 year ago

https://github.com/emancu/toml-rb - v3.0.1

What's Changed

New Contributors

Full Changelog: https://github.com/emancu/toml-rb/compare/v3.0.0...v3.0.1

- Ruby
Published by emancu almost 3 years ago

https://github.com/emancu/toml-rb - v3.0.0

The reason for releasing a major version is the fix on #146; even if it's an error, it breaks the previous behaviour that worked for a really long time and I don't want to cause unexpected issues to existing users.

What's Changed

New Contributors

Full Changelog: https://github.com/emancu/toml-rb/compare/v2.2.0...v3.0.0

- Ruby
Published by emancu almost 3 years ago

https://github.com/emancu/toml-rb - Fix Dumper when there are #$ in array elements.

There are special treatments to #$ when dumping string values, but this does not work properly for arrays.
Thanks @shanyungyang

https://github.com/emancu/toml-rb/pull/136

- Ruby
Published by emancu almost 5 years ago

https://github.com/emancu/toml-rb - Fixing errors caused by frozen-strings

Thanks to @bastelfreak and @ekohl for fixing this.

- Ruby
Published by emancu almost 5 years ago

https://github.com/emancu/toml-rb - Replace generic options hash with specific option.

In the past, we were supporting Ruby versions without named parameters and
we didn't know how many options will use for loading/parsing TOML.
Years have passed, and the interface is stable, so we are simplifying it.

This change will be useful for the adoption of Steep or defining types in Ruby 3 πŸŽ‰

It shouldn't break to most users, but just in case it does, I released a patch version (v2.0.2) with the fix for trailing spaces, so anyone can use the fix without dealing with the incompatibility of this version may introduce.

- Ruby
Published by emancu about 5 years ago

https://github.com/emancu/toml-rb - Fix trailing whitespace at the end of the document

Thanks @rodzhers for fixing the error.

https://github.com/emancu/toml-rb/pull/128

- Ruby
Published by emancu about 5 years ago

https://github.com/emancu/toml-rb - Fix TomlRB::Dumper

Dumping '#$' produces invalid TOML as '#$'.inspect introduces a single backslash before #.

https://github.com/emancu/toml-rb/pull/124

- Ruby
Published by emancu almost 7 years ago

https://github.com/emancu/toml-rb - TOML 0.5 support

I'm increasing the Major version number because it contains a breaking change explained here

Big news are we fully support TOML 0.5 + some fixes on different data types.

At the same time, we are adding support for ruby 2.6 and dropping support for ruby 2.2.

- Ruby
Published by emancu about 7 years ago

https://github.com/emancu/toml-rb - Fix comment parsing

Thanks to @greysteil for fixing the comment parsing.

- Ruby
Published by emancu over 8 years ago

https://github.com/emancu/toml-rb - Fixed Symbolized Table Arrays and old ruby deprecations

Several ruby versions were deprecated for some dependencies, so I took the same path.

Versions unsupported are 1.93, 2.0 and 2.1
On the other hand, I added the newest versions 2.3, 2.4 and 2.4.2 to the supported list

- Ruby
Published by emancu about 9 years ago

https://github.com/emancu/toml-rb - No more namespace conflicts

- Ruby
Published by emancu over 9 years ago

https://github.com/emancu/toml-rb - Multiline strings into arrays

- Ruby
Published by emancu about 10 years ago

https://github.com/emancu/toml-rb - Accept float arrays with exponent parts

- Ruby
Published by emancu over 10 years ago

https://github.com/emancu/toml-rb - Table arrays fixed

Includes issues #91 #90 #89

- Ruby
Published by emancu over 10 years ago

https://github.com/emancu/toml-rb - Accept numbers as keys

Fixes the issue #79

- Ruby
Published by emancu over 10 years ago

https://github.com/emancu/toml-rb - Accept white spaces between brackets and set defaults to datetimes

Bump to 0.3.11

This version includes the fixes for #84 and #85

- Ruby
Published by emancu over 10 years ago

https://github.com/emancu/toml-rb - Fix parsing of escaped sequences

- Ruby
Published by emancu over 10 years ago

https://github.com/emancu/toml-rb - Uninitialized Constant Error Fixed!

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - New error class to encapsulate all the errors

Pull Request #71

Thanks @timcolonel !

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - Clean namespace

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - Fix Invalid parse result for empty inline array

Related issue #64

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - Multiline comments fixed and value overwrite error

Closed issues #60 #59

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - Symbolize keys issue fixed for inline tables

Something went wrong with rubygems so I had to skip a few minor version numbers.

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - TOML v0.4.0 specs fully supported

This new version supports

  • Inline Tables
  • Array of Inline Tables
  • Underscore numbers

- Ruby
Published by emancu over 11 years ago

https://github.com/emancu/toml-rb - TOML specs v0.3.1 - Stable

The previous version added support for Array of Tables, a nice structure into TOML.
After a week of been released a few bugs were discovered and fixed.

This new release makes toml-rb more stable =)

- Ruby
Published by emancu almost 12 years ago

https://github.com/emancu/toml-rb - TOML v0.3.1 specs fully supported

Full v0.3.1 specs support.

This includes:

  • Array of Tables
  • Quoted keys
  • Multiline Arrays
  • Multiline Strings and Literals
  • Datetime RFC 3339

- Ruby
Published by emancu almost 12 years ago