struct
UCL::Value
- UCL::Value
- Struct
- Value
- Object
Overview
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.
Defined in:
ucl/value.crConstructors
Instance Method Summary
-
#[](key : String)
Returns the value for key, raising
KeyErrorif it is missing. -
#[]=(key : String, value)
Sets the value for key.
-
#[]?(key : String)
Returns the value for key, or
nilif it is missing. - #delete(*args, **options)
- #delete(*args, **options, &)
- #each(*args, **options)
- #each(*args, **options, &)
- #raw : Hash(String, UCL::Value::Type)
- #to_h(*args, **options)
- #to_h(*args, **options, &)
- #to_json(*args, **options)
- #to_json(*args, **options, &)
-
#to_ucl(emit_type : String | UCL::Emitter = UCL::Encoder::DEFAULT_EMITTER) : String
Serializes the underlying hash to UCL/JSON/YAML/MsgPack.
- #to_yaml(*args, **options)
- #to_yaml(*args, **options, &)
Constructor Detail
Instance Method Detail
Serializes the underlying hash to UCL/JSON/YAML/MsgPack. See UCL.dump.