Class: Doc2Text::XmlBasedDocument::DocumentFile
- Inherits:
-
Object
- Object
- Doc2Text::XmlBasedDocument::DocumentFile
show all
- Defined in:
- lib/doc2text/xml_based_document_file.rb
Instance Method Summary
collapse
Constructor Details
#initialize(document_path) ⇒ DocumentFile
Returns a new instance of DocumentFile.
6
7
8
|
# File 'lib/doc2text/xml_based_document_file.rb', line 6
def initialize(document_path)
@document_path = document_path
end
|
Instance Method Details
#clean ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/doc2text/xml_based_document_file.rb', line 26
def clean
if File.exist?() and
FileUtils.rm_r
else
puts 'Failed to clean temp files'
end
end
|
22
23
24
|
# File 'lib/doc2text/xml_based_document_file.rb', line 22
def
false
end
|
39
40
41
|
# File 'lib/doc2text/xml_based_document_file.rb', line 39
def
'unpacked'
end
|
43
44
45
|
# File 'lib/doc2text/xml_based_document_file.rb', line 43
def
File.join File.dirname(@document_path), ".#{File.basename(@document_path)}_#{}"
end
|
#open(filename) ⇒ Object
Open file from the current odt
35
36
37
|
# File 'lib/doc2text/xml_based_document_file.rb', line 35
def open(filename)
File.open File.join(, filename), 'r'
end
|
#unpack ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/doc2text/xml_based_document_file.rb', line 10
def unpack
Zip::File.open(@document_path) {
|zip_file|
Dir.mkdir()
zip_file.each do |entry|
= File.join , entry.name
FileUtils.mkdir_p File.dirname()
zip_file. entry,
end
}
end
|