Class: LexxyVariables::AttachmentType
- Inherits:
-
Struct
- Object
- Struct
- LexxyVariables::AttachmentType
- Defined in:
- lib/lexxy_variables/attachment_type.rb
Overview
Describes one kind of attachment chip the pipeline knows how to resolve. A chip is identified solely by its content-type, which the editor always writes and the model always persists.
phase:
:value the resolver returns a String key. The pipeline records it, emits
a nonce-protected placeholder, and later substitutes the resolved
HTML-escaped value. Safe by construction. Variables use this.
:fragment the resolver returns rich content (ActionText content, RichText,
or an HTML String) spliced into the document BEFORE sanitization,
so the sanitizer cleans it and inner :value chips resolve in the
same pass. Snippets use this. Bounded by max_fragment_depth.
resolve: ->(node, context) { ... } returning a key (:value) or rich content (:fragment), or nil to drop the chip.
label: optional short type name (e.g. "Variable", "Snippet"). The prompt shows it as a badge only when the list mixes more than one type, so users can tell them apart without noise when there is only one. nil shows no badge.
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#label ⇒ Object
Returns the value of attribute label.
-
#phase ⇒ Object
Returns the value of attribute phase.
-
#resolve ⇒ Object
Returns the value of attribute resolve.
Instance Method Summary collapse
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type
21 22 23 |
# File 'lib/lexxy_variables/attachment_type.rb', line 21 def content_type @content_type end |
#label ⇒ Object
Returns the value of attribute label
21 22 23 |
# File 'lib/lexxy_variables/attachment_type.rb', line 21 def label @label end |
#phase ⇒ Object
Returns the value of attribute phase
21 22 23 |
# File 'lib/lexxy_variables/attachment_type.rb', line 21 def phase @phase end |
#resolve ⇒ Object
Returns the value of attribute resolve
21 22 23 |
# File 'lib/lexxy_variables/attachment_type.rb', line 21 def resolve @resolve end |
Instance Method Details
#fragment? ⇒ Boolean
23 |
# File 'lib/lexxy_variables/attachment_type.rb', line 23 def fragment? = phase == :fragment |
#value? ⇒ Boolean
22 |
# File 'lib/lexxy_variables/attachment_type.rb', line 22 def value? = phase == :value |