Class: Docxtor2::Package
- Inherits:
-
Object
- Object
- Docxtor2::Package
- Defined in:
- lib/docxtor2.rb,
lib/docxtor2/package.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
-
#initialize(parts, document) ⇒ Package
constructor
A new instance of Package.
- #save(filepath) ⇒ Object
- #to_stream ⇒ Object
Constructor Details
Instance Attribute Details
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
3 4 5 |
# File 'lib/docxtor2/package.rb', line 3 def parts @parts end |
Instance Method Details
#save(filepath) ⇒ Object
10 11 12 13 14 |
# File 'lib/docxtor2/package.rb', line 10 def save(filepath) Zip::ZipOutputStream.open(filepath) do |ostream| write_parts(ostream) end end |
#to_stream ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/docxtor2/package.rb', line 16 def to_stream ostream = Zip::ZipOutputStream.new("streamed", true) write_parts(ostream) string_io = ostream.close_buffer string_io.rewind string_io end |