Class: BxBuilderChain::Processors::Docx
- Defined in:
- lib/bx_builder_chain/processors/docx.rb
Constant Summary collapse
- EXTENSIONS =
[".docx"]
- CONTENT_TYPES =
["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]
Instance Method Summary collapse
-
#initialize ⇒ Docx
constructor
A new instance of Docx.
-
#parse(data) ⇒ String
Parse the document and return the text.
Methods included from DependencyHelper
Constructor Details
#initialize ⇒ Docx
Returns a new instance of Docx.
9 10 11 12 |
# File 'lib/bx_builder_chain/processors/docx.rb', line 9 def initialize(*) depends_on "docx" require "docx" end |
Instance Method Details
#parse(data) ⇒ String
Parse the document and return the text
17 18 19 20 21 22 |
# File 'lib/bx_builder_chain/processors/docx.rb', line 17 def parse(data) ::Docx::Document .open(StringIO.new(data.read)) .text .strip end |