===
Ptolemy
is a simple TOML parser for Ruby, based on Treetop. It is useful for parsing the TOML Format.
Ptolemy
currently supports version 0.1.0 of TOML.
Add this to your Gemfile
gem 'ptolemy'
And then run
bundle install
You can install it manually using
gem install ptolemy
-
Ptolemy.parse
can parse a string in TOML format.data = <<END # This is an example TOML input [group] string = "hello" integer = 0 END Ptolemy.parse(data) # => {"group"=>{"string"=>"hello", "integer"=>0}}
-
Ptolemy.parse_file
can read from a UTF-8 encoded file directly.filename = 'example.toml' Ptolemy.parse_file(filename)
Ptolemy
has a fairly exhaustive test suite built on rspec
and can
successfully parse the specification file and hard example given
in the TOML specification.
You can run the test suite by running rake
.