Class: Doc2Text::Pptx::Document

Inherits:
XmlBasedDocument::DocumentFile show all
Defined in:
lib/doc2text/pptx/pptx.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XmlBasedDocument::DocumentFile

#clean, #extract_path, #initialize, #open, #unpack

Constructor Details

This class inherits a constructor from Doc2Text::XmlBasedDocument::DocumentFile

Class Method Details

.parse_and_save(input, output_filename) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/doc2text/pptx/pptx.rb', line 5

def self.parse_and_save(input, output_filename)
  docx = new input
  begin
    docx.unpack
    output = File.open output_filename, 'w'
    markdown = Markdown::DocxParser.new output, nil
    begin
      docx.parse markdown
    ensure
      markdown.close
    end
  ensure
    docx.clean
  end
end

Instance Method Details

#contains_extracted_files?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/doc2text/pptx/pptx.rb', line 21

def contains_extracted_files?
  File.exist? File.join(extract_path, '[Content_Types].xml')
end

#extract_extensionObject


25
26
27
# File 'lib/doc2text/pptx/pptx.rb', line 25

def extract_extension
  'unpacked_pptx'
end