0.0
No release in over a year
Allows for easy YAML parsing and type checking, as well as generators
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Usage

Config File:

url: localhost:3000/
port: 3000

remote:
  port: 5000
  greetings:
    - Hello!
    - Welcome!

Example without schema

require "strong_yaml"

class Config
  include StrongYAML

  file "config.yml"
end

Config.load

Config.url
# "localhost:3000/"
Config.port
# 3000
Config.remote.port
# 5000
Config.remote.greetings
# ["Hello!", "Welcome!"]

Example with schema

require "strong_yaml"

class Config
  include StrongYAML

  file "config.yml"

  schema do
    string :url, default: "localhost:3000/"
    integer :port, default: 3000

    group :remote do
      integer :port, default: 5000
      list :greetings, default: ["Hello!", "Welcome!"]
    end
  end
end

Config.create_or_load