Module: Sevgi::Graphics::Mixtures::Export
- Defined in:
- lib/sevgi/graphics/mixtures/export.rb
Overview
DSL helpers for native SVG export formats.
Instance Method Summary collapse
-
#PDF(path = nil, **kwargs) {|svg| ... } ⇒ String
Exports the document as PDF.
-
#PNG(path = nil, **kwargs) {|svg| ... } ⇒ String
Exports the document as PNG.
Instance Method Details
#PDF(path = nil, **kwargs) {|svg| ... } ⇒ String
Exports the document as PDF. Relative paths are expanded, missing parent directories are created after export validation, and an existing file is replaced. An existing directory target uses the caller-derived default PDF name.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/sevgi/graphics/mixtures/export.rb', line 48 def PDF(path = nil, **kwargs, &block) kwargs = Options.(kwargs) begin require "sevgi/sundries" rescue ::LoadError => e raise unless e.path == "sevgi/sundries" MissingComponentError.("sevgi/sundries") end Export(path, **kwargs, format: :pdf, &block) end |
#PNG(path = nil, **kwargs) {|svg| ... } ⇒ String
Exports the document as PNG. Relative paths are expanded, missing parent directories are created after export validation, and an existing file is replaced. An existing directory target uses the caller-derived default PNG name.
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/sevgi/graphics/mixtures/export.rb', line 83 def PNG(path = nil, **kwargs, &block) kwargs = Options.(kwargs) begin require "sevgi/sundries" rescue ::LoadError => e raise unless e.path == "sevgi/sundries" MissingComponentError.("sevgi/sundries") end Export(path, **kwargs, format: :png, &block) end |