Class: TypstRails::Backends::Base Abstract
- Inherits:
-
Object
- Object
- TypstRails::Backends::Base
- Defined in:
- lib/typst_rails/backends/base.rb
Overview
This class is abstract.
Abstract interface for a Typst compilation backend.
A backend is responsible for turning a Typst source file (plus a root directory for relative imports) into PDF bytes. Subclasses implement #available? and #compile.
Instance Method Summary collapse
-
#available? ⇒ Boolean
Whether this backend can be used in the current environment (e.g. the
typstexecutable is on PATH, or thetypstgem is loaded). -
#compile(typ_path, root_dir) ⇒ String
Compiles a Typst source file to PDF.
Instance Method Details
#available? ⇒ Boolean
Returns whether this backend can be used in the current environment
(e.g. the typst executable is on PATH, or the typst gem is loaded).
15 16 17 |
# File 'lib/typst_rails/backends/base.rb', line 15 def available? raise NotImplementedError, "#{self.class} must implement #available?" end |
#compile(typ_path, root_dir) ⇒ String
Compiles a Typst source file to PDF.
25 26 27 |
# File 'lib/typst_rails/backends/base.rb', line 25 def compile(typ_path, root_dir) raise NotImplementedError, "#{self.class} must implement #compile" end |