struct

UCL::Value

Inherits Struct < Value < Object

A thin wrapper around a Hash(String, Type), and the namespace for the Type union returned by the public API.

Value behaves like a string-keyed hash (#[], #[]?, #[]=, #each, #delete) and can be serialized with #to_json / #to_yaml.

NOTE: this is a struct wrapping a Hash (a reference). Copying a Value shares the same underlying hash, so mutations are visible through every copy — treat it as a handle, not a value type.

Constructors

new

Creates an empty value backed by a fresh Hash(String, Type).

Source

Instance methods

[](key : String)

Returns the value for key, raising KeyError if it is missing.

Source
[]=(key : String, value)

Sets the value for key.

Source
[]?(key : String)

Returns the value for key, or nil if it is missing.

Source
delete(*args, **options)
Source
delete(*args, **options, &)
Source
each(*args, **options)
Source
each(*args, **options, &)
Source
raw

Returns the underlying Hash(String, Type).

Source
to_h(*args, **options)
Source
to_h(*args, **options, &)
Source
to_json(*args, **options)
Source
to_json(*args, **options, &)
Source
to_ucl(emit_type : String | UCL::Emitter = UCL::Encoder::DEFAULT_EMITTER) : String

Serializes the underlying hash to UCL/JSON/YAML/MsgPack. See UCL.dump.

Source
to_yaml(*args, **options)
Source
to_yaml(*args, **options, &)
Source

Nested types