struct

Cl8r::Config::Schema

Inherits YAML::Serializable < Struct < Value < Object

Data model and strict validation schema for cl8r configuration settings.

Constants

ALLOWED_COLORS = ["auto", "always", "never"] of ::String
ALLOWED_LANGUAGES = ["en", "en-US", "es", "es-MX"] of ::String
ALLOWED_OUTPUT_FORMATS = ["pretty", "text", "json", "yaml", "csv"] of ::String
ALLOWED_PROFILES = ["minimal", "small", "medium", "large", "ceph", "libvirt", "libvirt-ceph", "openshift", "openstack", "generic"] of ::String
VALID_KEYS = ["language", "output_format", "color", "server_host", "server_port", "default_profile"] of ::String

Constructors

new(language : String = "en", output_format : String = "pretty", color : String = "auto", server_host : String = "0.0.0.0", server_port : Int32 = 8080, default_profile : String = "minimal")
Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source

Class methods

normalize_language(lang : String) : String

Normalizes language input such as 'es_MX' or 'es-mx' into 'es-MX'

Source
validate_key!(key : String) : String

Validates whether a key name is a known configuration parameter.

Source
validate_value!(canonical_key : String, raw_value : String) : String | Int32

Validates and normalizes the value for a specific configuration key.

Source

Instance methods

color
Source
color=(color : String)
Source
default_profile
Source
default_profile=(default_profile : String)
Source
get(key : String) : String

Gets a property by string key name.

Source
language
Source
language=(language : String)
Source
output_format
Source
output_format=(output_format : String)
Source
server_host
Source
server_host=(server_host : String)
Source
server_port
Source
server_port=(server_port : Int32)
Source
set(key : String, value_str : String) : Nil

Sets a property by string key name with validation.

Source
to_h

Exports all key-value pairs as a Hash for tabular display.

Source
unset(key : String) : Nil

Resets a property by string key name to default.

Source