Class: Kobako::Snippet::Source
- Inherits:
-
Data
- Object
- Data
- Kobako::Snippet::Source
- Defined in:
- lib/kobako/snippet/source.rb,
sig/kobako/snippet/source.rbs
Overview
Kobako::Snippet::Source — value object representing a single
#preload(code:, name:) entry held by Kobako::Catalog::Snippets.
name is the canonical Symbol identity baked into the loaded
IREP's debug_info; backtrace frames originating in this snippet
surface as (snippet:Name):line. body is the UTF-8 mruby source
detached from the caller's reference at Catalog::Snippets#register
time so later mutation of the original String cannot bleed through.
The class is a Data.define subclass — frozen, value-equal, and
carries no mutation API. Callers (chiefly Catalog::Snippets)
construct instances via keyword form Source.new(name: ..., body: ...).
Wire-form construction is the registry's responsibility: as a leaf
carrier this Source stays pure and Catalog::Snippets#encode reads
its attributes off the outside rather than asking it to self-encode.
Constant Summary collapse
- KIND =
The
kindfield value carried by source snippets in their Frame 3 wire envelope entry (docs/wire-codec.md Invocation channels). "source"
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
Returns the value of attribute body.
-
#name ⇒ Symbol
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Attribute Details
#body ⇒ String (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'sig/kobako/snippet/source.rbs', line 7 def body @body end |
#name ⇒ Symbol (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'sig/kobako/snippet/source.rbs', line 6 def name @name end |