abstract struct Stelios::IO::Badge
- Stelios::IO::Badge
- Struct
- Value
- Object
Overview
The output format of the Stelios engine.
For every kind of output, the engine outputs a Badge
, which defines its own fields. A badge shouldn't contain any complex
objects, though it can recursively contain other badges.
For example, instead of passing a Stelios::Item
class to the renderer, it should instead output a Stelios::IO::Badge::Item
badge,
containing the same information as the class, but statically. A renderer is then free to parse this badge however necessary, for example,
a graphical renderer might use an icon from the item instead of the item name.
Additionally, badges can contain a #variant
hash that contains more dynamic metadata about the badge. See #variant
for more.
Direct Known Subclasses
Defined in:
engine/io.crConstructors
Instance Method Summary
- #initialize
-
#variant : Hash(String, String | Nil)
Badges can contain a hash that contains more dynamic metadata about the badge.
Instance methods inherited from class Object
to_sban(io : IO)to_sban(encoder : SBAN::Encoder)
to_sban : Bytes to_sban
Class methods inherited from class Object
from_sban(string_or_io)
from_sban
Constructor Detail
Instance Method Detail
Badges can contain a hash that contains more dynamic metadata about the badge.
This variant information can be set by the engine, but also, for example, the locale system.
For example, a locale string can set the plurality of an item name, of for languages with complex case system, the case of the item name
within the sentence. Handling such information is left to the renderer.
Descendants of Badge
should override the default empty hash if they contain any additional information.