Superconf::Option(T)
Inherits Superconf::AbstractOption < Reference < Object
One registered, typed configuration option.
T may be Bool, Int32, Int64, Float64, String, Char,
Time::Span, or any Enum (including @[Flags] enums). Any other type is
supported by passing an explicit parse: proc to register.
Constructors
Instance methods
Build an alias of this option, registered under key with its own
env/CLI/group surfaces but sharing this option's value. Used by
Superconf.register_alias.
Change the recorded default (used by Superconf.set_default). Doesn't
itself change the effective value; the caller also sets at Default
precedence so config/env/CLI/runtime still win. Validated here because a
set at Default precedence is skipped once a higher source has won, so
an invalid default could otherwise slip in unvalidated and later surface
(e.g. via default_string, or once the higher source is cleared).
Numeric/bool values are emitted as plain scalars (0.2, true) so they
re-read with their native YAML types. Strings and enums are force-quoted:
an unquoted yes, no, null or 123 would otherwise be re-parsed by
YAML 1.1 as a bool/nil/int and corrupt the value on reload. stringify
already normalizes Time::Span to seconds.
Typed assignment. Applies only if source is at least as authoritative
as the source of the current value (see Source); a value that wins
must also pass the option's validate predicate, if any.
Parse str and store it, honoring precedence (see Source).