Class: DerivativeRodeo::Services::PdfSplitter::Base Abstract
- Inherits:
-
Object
- Object
- DerivativeRodeo::Services::PdfSplitter::Base
- Includes:
- Enumerable
- Defined in:
- lib/derivative_rodeo/services/pdf_splitter/base.rb
Overview
This class is abstract.
The purpose of this class is to split the PDF into constituent image files.
Instance Attribute Summary collapse
-
#ghost_script_output_file_template ⇒ Object
readonly
Returns the value of attribute ghost_script_output_file_template.
Instance Method Summary collapse
- #each {|the| ... } ⇒ Object
- #gsdevice ⇒ Object private
-
#initialize(path, image_file_basename_template:, pdf_pages_summary: PagesSummary.extract_from(path: path)) ⇒ Base
constructor
A new instance of Base.
- #invalid_pdf? ⇒ Boolean private
Constructor Details
#initialize(path, image_file_basename_template:, pdf_pages_summary: PagesSummary.extract_from(path: path)) ⇒ Base
Returns a new instance of Base.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/derivative_rodeo/services/pdf_splitter/base.rb', line 50 def initialize(path, image_file_basename_template:, pdf_pages_summary: PagesSummary.extract_from(path: path)) @pdfpath = path @pdf_pages_summary = pdf_pages_summary @ghost_script_output_file_template = File.join(File.dirname(path), image_file_basename_template) # We need to ensure that this temporary directory exists so we can write the files to it. # Fortunately, because this file space must be "local" tmp dir, we don't need to work # through any of the location antics of {StorageLocations::BaseLocation}. FileUtils.mkdir_p(File.dirname(@ghost_script_output_file_template)) end |
Instance Attribute Details
#ghost_script_output_file_template ⇒ Object (readonly)
Returns the value of attribute ghost_script_output_file_template.
63 64 65 |
# File 'lib/derivative_rodeo/services/pdf_splitter/base.rb', line 63 def ghost_script_output_file_template @ghost_script_output_file_template end |
Instance Method Details
#each {|the| ... } ⇒ Object
74 75 76 |
# File 'lib/derivative_rodeo/services/pdf_splitter/base.rb', line 74 def each(&block) entries.each(&block) end |
#gsdevice ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 90 91 |
# File 'lib/derivative_rodeo/services/pdf_splitter/base.rb', line 87 def gsdevice return self.class.gsdevice if self.class.gsdevice raise NotImplementedError, "#{self.class}#gsdevice" end |
#invalid_pdf? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
79 80 81 |
# File 'lib/derivative_rodeo/services/pdf_splitter/base.rb', line 79 def invalid_pdf? !pdf_pages_summary.valid? end |