Class: Vivlio::PDF::Result
- Inherits:
-
Object
- Object
- Vivlio::PDF::Result
- Defined in:
- lib/vivlio/pdf/result.rb
Overview
The outcome of one conversion.
Behaves like the output path in string contexts, so callers that only care where the file landed can keep treating the return value as one.
Instance Attribute Summary collapse
-
#bookmarks ⇒ Object
readonly
outlineis the table of contents we read from the viewer, empty when the bookmarks came from Chromium instead. -
#outline ⇒ Object
readonly
outlineis the table of contents we read from the viewer, empty when the bookmarks came from Chromium instead. -
#pages ⇒ Object
readonly
outlineis the table of contents we read from the viewer, empty when the bookmarks came from Chromium instead. -
#path ⇒ Object
readonly
outlineis the table of contents we read from the viewer, empty when the bookmarks came from Chromium instead. -
#warnings ⇒ Object
readonly
outlineis the table of contents we read from the viewer, empty when the bookmarks came from Chromium instead.
Instance Method Summary collapse
-
#initialize(path:, pages:, bookmarks:, outline: [], warnings: []) ⇒ Result
constructor
A new instance of Result.
- #inspect ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(path:, pages:, bookmarks:, outline: [], warnings: []) ⇒ Result
Returns a new instance of Result.
15 16 17 18 19 20 21 22 |
# File 'lib/vivlio/pdf/result.rb', line 15 def initialize(path:, pages:, bookmarks:, outline: [], warnings: []) @path = path.to_s @pages = pages @bookmarks = bookmarks @outline = outline.freeze @warnings = warnings.freeze freeze end |
Instance Attribute Details
#bookmarks ⇒ Object (readonly)
outline is the table of contents we read from the viewer, empty when
the bookmarks came from Chromium instead. bookmarks counts what the
PDF really contains, so it holds for every outline mode.
13 14 15 |
# File 'lib/vivlio/pdf/result.rb', line 13 def bookmarks @bookmarks end |
#outline ⇒ Object (readonly)
outline is the table of contents we read from the viewer, empty when
the bookmarks came from Chromium instead. bookmarks counts what the
PDF really contains, so it holds for every outline mode.
13 14 15 |
# File 'lib/vivlio/pdf/result.rb', line 13 def outline @outline end |
#pages ⇒ Object (readonly)
outline is the table of contents we read from the viewer, empty when
the bookmarks came from Chromium instead. bookmarks counts what the
PDF really contains, so it holds for every outline mode.
13 14 15 |
# File 'lib/vivlio/pdf/result.rb', line 13 def pages @pages end |
#path ⇒ Object (readonly)
outline is the table of contents we read from the viewer, empty when
the bookmarks came from Chromium instead. bookmarks counts what the
PDF really contains, so it holds for every outline mode.
13 14 15 |
# File 'lib/vivlio/pdf/result.rb', line 13 def path @path end |
#warnings ⇒ Object (readonly)
outline is the table of contents we read from the viewer, empty when
the bookmarks came from Chromium instead. bookmarks counts what the
PDF really contains, so it holds for every outline mode.
13 14 15 |
# File 'lib/vivlio/pdf/result.rb', line 13 def warnings @warnings end |
Instance Method Details
#inspect ⇒ Object
33 34 35 |
# File 'lib/vivlio/pdf/result.rb', line 33 def inspect "#<#{self.class} #{path.inspect} pages=#{pages} bookmarks=#{bookmarks}>" end |
#size ⇒ Object
24 25 26 |
# File 'lib/vivlio/pdf/result.rb', line 24 def size File.size(path) end |
#to_s ⇒ Object Also known as: to_str
28 29 30 |
# File 'lib/vivlio/pdf/result.rb', line 28 def to_s path end |