Class: Typstify::ErbPipeline::Context
- Inherits:
-
Object
- Object
- Typstify::ErbPipeline::Context
- Defined in:
- lib/typstify/erb_pipeline.rb
Overview
The object templates are evaluated against. Deliberately small: typ,
data, and whatever instance variables the controller had.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
The data hash passed to
render pdf:/Typstify.render.
Instance Method Summary collapse
-
#initialize(data:, assigns: {}) ⇒ Context
constructor
A new instance of Context.
- #template_binding ⇒ Object
-
#typ(value) ⇒ Object
Escape a value so Typst renders it literally.
Constructor Details
#initialize(data:, assigns: {}) ⇒ Context
Returns a new instance of Context.
18 19 20 21 |
# File 'lib/typstify/erb_pipeline.rb', line 18 def initialize(data:, assigns: {}) @data = data assigns.each { |name, value| instance_variable_set(:"@#{name}", value) } end |
Instance Attribute Details
#data ⇒ Object (readonly)
The data hash passed to render pdf: / Typstify.render.
24 25 26 |
# File 'lib/typstify/erb_pipeline.rb', line 24 def data @data end |
Instance Method Details
#template_binding ⇒ Object
31 32 33 |
# File 'lib/typstify/erb_pipeline.rb', line 31 def template_binding binding end |