=== 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.
Installation
Bundler
Add this to your Gemfile
gem 'ptolemy', '~> 0.0.2'
And then run
bundle install
Manual
You can install it manually using
gem install ptolemy
Usage
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)
Test Suite
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
.