Skip to content
crystal toml parser
Crystal
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
LICENSE
README.md
config.toml.example

README.md

Crystal (dotted) TOML Parser

example

  #! /usr/bin/env crystal
  require "toml_slowly"
  
  def main()
    toml_string = %(
  [default.a]
  title = "TOML Example"

  [ default.b ]
  [ great.owner]
  good.name = "Lance Uppercut"
  nice.dob = 1979-05-27T07:32:00Z
  )
 
  hash = TOML_Slowly.parse(toml_string)
  p hash
  end

  main()

result

  {
    "default.a.title" => "TOML Example",
    "great.owner.good.name" => "Lance Uppercut",
    "great.owner.nice.dob" => "1979-05-27T07:32:00Z"
  }

optional

bless

like hash

  hash = TOML_Slowly.parse(toml_string)
  blessed = TOML_Slowly.bless(hash)

  # keys
  #   ["a.title"]
  p blessed["default"].keys

  # values
  #   []
  p blessed["default"].values

  # value
  puts blessed["default"]["a"]["title"].as_s
You can’t perform that action at this time.