Class: LiquidXlsx::FilePart
- Inherits:
-
Object
- Object
- LiquidXlsx::FilePart
- Defined in:
- lib/liquid_xlsx/file_part.rb
Overview
A worksheet envelope around rows on disk. Ownership passes to Package; neither the complete XML nor its ZIP input is accumulated in memory.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #bytesize ⇒ Object
- #close ⇒ Object
-
#initialize(file, prefix, suffix) ⇒ FilePart
constructor
A new instance of FilePart.
- #write_to(output) ⇒ Object
Constructor Details
#initialize(file, prefix, suffix) ⇒ FilePart
Returns a new instance of FilePart.
11 12 13 14 15 |
# File 'lib/liquid_xlsx/file_part.rb', line 11 def initialize(file, prefix, suffix) @file = file @prefix = prefix @suffix = suffix end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/liquid_xlsx/file_part.rb', line 9 def file @file end |
Instance Method Details
#bytesize ⇒ Object
17 18 19 |
# File 'lib/liquid_xlsx/file_part.rb', line 17 def bytesize @prefix.bytesize + @file.size + @suffix.bytesize end |
#close ⇒ Object
28 29 30 |
# File 'lib/liquid_xlsx/file_part.rb', line 28 def close @file.close! end |
#write_to(output) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/liquid_xlsx/file_part.rb', line 21 def write_to(output) output.write(@prefix) @file.rewind IO.copy_stream(@file, output) output.write(@suffix) end |