abstract class Comandante::ConfigSingleton
- Comandante::ConfigSingleton
- Reference
- Object
Overview
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
Defined in:
comandante/config_singleton.crClass Method Summary
-
.load_config(file)
Used to load/read config file
-
.to_yaml
Dumps to yaml
Macro Summary
-
config_type(klass, &block)
defines a config type and accessors of its properties on the singleton class as well as on @config, also defines a load_config
-
sub_config_type(klass, &block)
test this
Class Method Detail
Macro Detail
macro config_type(klass, &block)
#
defines a config type and accessors of its properties on the singleton class as well as on @config, also defines a load_config