Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crystal-community/toml.cr
TOML parser for Crystal
https://github.com/crystal-community/toml.cr
Last synced: about 2 months ago
JSON representation
TOML parser for Crystal
- Host: GitHub
- URL: https://github.com/crystal-community/toml.cr
- Owner: crystal-community
- Created: 2015-02-16T16:05:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T13:41:13.000Z (6 months ago)
- Last Synced: 2024-05-06T00:04:50.824Z (5 months ago)
- Language: Crystal
- Size: 63.5 KB
- Stars: 58
- Watchers: 11
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-crystal - toml.cr - TOML parser (Data Formats)
- awesome-crystal - toml.cr - TOML parser (Data Formats)
README
# toml.cr
[![Build Status](https://travis-ci.org/crystal-community/toml.cr.png)](https://travis-ci.org/crystal-community/toml.cr)
A [TOML](https://github.com/toml-lang/toml) parser for [Crystal](http://crystal-lang.org/), compliant with the v0.5.0 version of TOML.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
toml:
github: crystal-community/toml.cr
branch: master
```### Usage
```crystal
require "toml"toml_string = %(
title = "TOML Example"[owner]
name = "Lance Uppercut"
dob = 1979-05-27T07:32:00Z
)toml = TOML.parse(toml_string)
puts toml["title"] #=> "TOML Example"owner = toml["owner"].as(Hash)
puts owner["name"] #=> "Lance Uppercut"
puts owner["dob"] #=> "1979-05-27 07:32:00 UTC"
```