Project

ptolemy

0.0
No commit activity in last 3 years
No release in over 3 years
Ptolemy is a TOML parser.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Ptolemy

Build Status Gem Version

=== 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'

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.