# line 36
text.split("#").first
This will have trouble with a line like: tweet = "TOML is #awesomesauce"
-- # line 43
array = $1.split(",").map {|s| s.strip.gsub(/\"(.*)\"/, '\1')}
You should recurse into coerce here, or you'll just lose types. (Also you're assuming arrays of strings.) array = $1.split(",").map {|s| coerce(s) }
--You're also not dealing with nested key groups. (eg. [servers.alpha]).
--
That being said, naïve string parsing is a terrible way to build a new markup language implementation. It's the reason the Markdown landscape is such a mess[1]. What this really needed is a formal grammar.
[1]: I actually tried to fixed that by writing a formal lexer & informal parser for Markdown in a side-project of mine[2]. It's not quite there yet, because for practicality reasons I wrote my own parser instead of a formal AST-generating parser.
Made it into a proper project/gem here if you want to file issues: https://github.com/jm/toml
And good call on the nested key groups. Shouldn't be hard to knock that out.