Skip to content

OfficialPhilcomm/strong_yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages