class

Superconf::Alias(T)

Inherits Superconf::AbstractOption < Reference < Object

A second name for an already-registered option, sharing its value, type, default, parsing and validation. Carries its own config key, environment variable and CLI flag, but every read/write forwards to the target option.

Created by Superconf.register_alias / .option_alias to promote a lower-level (library) option under an app's own name. The target is always a concrete Option(T): aliases of aliases collapse to the underlying option (see Superconf.register_alias), so there's never a chain to walk.

Constructors

new(key : String, target : Option(T), *, explicit_env : String | Nil, cli : String, group : String, description : String)
Source

Instance methods

alias_target

The option an alias forwards to, or nil for a normal option. An alias (see Superconf.register_alias) shares another option's value, type, default, parsing and validation.

Source
bool?

Is the value type Bool? Governs --flag / --no-flag generation.

Source
build_alias(key : String, *, explicit_env : String | Nil, cli : String, group : String, description : String) : AbstractOption

Aliasing an alias targets the same underlying option, never this wrapper.

Source
default_string

The registered default, rendered as a string.

Source
emit_json(json : JSON::Builder) : Nil

Emit the current value as a native JSON value.

Source
emit_yaml(yaml : YAML::Builder) : Nil

Emit the current value as a native YAML scalar.

Source
origin
Source
set(value : T, source : Source = Source::Runtime, origin : String = "API") : Nil

Assign through to the target option (same precedence rules apply).

Source
set_from_string(str : String, source : Source, origin : String) : Nil

Parse str and store it, honoring precedence (see Source).

Source
source

Mirrors the target's, so a dump shows where the shared value actually came from regardless of which name set it.

Source
stringify

Current value rendered as the string used across env/CLI/config/dumps.

Source
target

The option this alias forwards to.

Source
value

The shared value, read straight from the target.

Source