Class: DocxTools::Document
- Inherits:
-
Object
- Object
- DocxTools::Document
- Defined in:
- lib/docx_tools/document.rb
Instance Attribute Summary collapse
-
#zip ⇒ Object
the stored zip file (docx).
Instance Method Summary collapse
-
#entries ⇒ Object
the entries contained within the zip.
-
#get(filename) ⇒ Object
read the file within the zip at the given filename.
-
#initialize(filepath) ⇒ Document
constructor
read the filepath and parse it as a zip file.
Constructor Details
#initialize(filepath) ⇒ Document
read the filepath and parse it as a zip file
8 9 10 |
# File 'lib/docx_tools/document.rb', line 8 def initialize(filepath) self.zip = Zip::File.open(filepath) end |
Instance Attribute Details
#zip ⇒ Object
the stored zip file (docx)
5 6 7 |
# File 'lib/docx_tools/document.rb', line 5 def zip @zip end |
Instance Method Details
#entries ⇒ Object
the entries contained within the zip
13 14 15 |
# File 'lib/docx_tools/document.rb', line 13 def entries zip.entries end |
#get(filename) ⇒ Object
read the file within the zip at the given filename
18 19 20 |
# File 'lib/docx_tools/document.rb', line 18 def get(filename) Nokogiri::XML(zip.read(filename)) end |