Module: ConfigX

Defined in:
lib/config_x.rb,
lib/config_x/config.rb,
lib/config_x/source.rb,
lib/config_x/builder.rb,
lib/config_x/version.rb,
lib/config_x/env_source.rb,
lib/config_x/file_source.rb,
lib/config_x/hash_source.rb,
lib/config_x/yaml_source.rb,
lib/config_x/configurable.rb,
lib/config_x/config_factory.rb,
lib/config_x/untyped_config.rb

Defined Under Namespace

Modules: Configurable Classes: Builder, Config, ConfigFactory, EnvSource, FileSource, HashSource, Source, UntypedConfig, YamlSource

Constant Summary collapse

VERSION =
"0.6.0"

Class Method Summary collapse

Class Method Details

.from(source, **args) ⇒ ConfigX::UntypedConfig

Loads config from the given source

Examples:

config = ConfigX.from({api: {endpoint: "http://example.com", enabled: true}})
config.api.endpoint # => "http://example.com"
config.api.enabled # => true

Returns:



25
# File 'lib/config_x.rb', line 25

def from(source, **args) = builder.add_source(source, **args).load(config_class: UntypedConfig)

.loadConfigurable

Returns:



17
# File 'lib/config_x.rb', line 17

def load(...) = ConfigFactory.load(...)

.loaderZeitwerk::Loader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Zeitwerk::Loader)


10
11
12
13
14
# File 'lib/config_x.rb', line 10

def loader
  @loader ||= Zeitwerk::Loader.for_gem.tap do |loader|
    loader.ignore("#{__dir__}/configx.rb")
  end
end