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