abstract class Comandante::ConfigSingleton
inherits Reference

Create your config class from this

Example

class Config < ConfigSingleton
  config_type(MyConfig) do
    name : String = "foo"
    age : Int32 = 150
  end
  ...
end

if you intend to use nested types define one or more sub_config_type

sub_config_type(URLConfig) do
  scheme : String = "https"
  no_proxy : Bool = false
end

config_type(ServerConfig) do
  urls : Hash(String, URLConfig) = Hash(String, URLConfig).new
end

Included modules

Comandante Comandante::Macros

Class methods

.load_config(file)

Used to load/read config file

Example

Config.load_config(ARGV[0])
View source

.to_yaml

Dumps to yaml

Example

Config.to_yaml
View source

Macros

config_type

defines a config type and accessors of its properties on the singleton class as well as on @config, also defines a load_config

View source

sub_config_type

test this

View source