Class: Vivlio::PDF::Source
- Defined in:
- lib/vivlio/pdf/source.rb
Overview
A document to render: a single HTML file, the OPF of an unzipped EPUB, or a webpub manifest. Beyond being a local file, it knows only whether it brings a spine with it.
Constant Summary collapse
- OPF_EXTENSIONS =
['.opf'].freeze
- MANIFEST_NAMES =
['publication.json', 'manifest.json'].freeze
Instance Attribute Summary
Attributes inherited from LocalFile
Instance Method Summary collapse
-
#initialize(path) ⇒ Source
constructor
A new instance of Source.
-
#publication? ⇒ Boolean
A publication (EPUB/webpub) has a spine to follow; a lone HTML file does not.
Methods inherited from LocalFile
Constructor Details
#initialize(path) ⇒ Source
Returns a new instance of Source.
12 13 14 |
# File 'lib/vivlio/pdf/source.rb', line 12 def initialize(path) super(path, kind: 'source') end |
Instance Method Details
#publication? ⇒ Boolean
A publication (EPUB/webpub) has a spine to follow; a lone HTML file does not. Only used as the default for Printer#print's book_mode:.
18 19 20 21 |
# File 'lib/vivlio/pdf/source.rb', line 18 def publication? OPF_EXTENSIONS.include?(File.extname(path).downcase) || MANIFEST_NAMES.include?(File.basename(path)) end |