Class: OpenXmlPackage
- Inherits:
-
Object
- Object
- OpenXmlPackage
- Defined in:
- lib/open_xml_package.rb,
lib/open_xml_package/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
- #add_part(path, part) ⇒ Object
-
#initialize ⇒ OpenXmlPackage
constructor
A new instance of OpenXmlPackage.
- #write_to(path) ⇒ Object
Constructor Details
#initialize ⇒ OpenXmlPackage
Returns a new instance of OpenXmlPackage.
8 9 10 |
# File 'lib/open_xml_package.rb', line 8 def initialize @parts = {} end |
Instance Attribute Details
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
6 7 8 |
# File 'lib/open_xml_package.rb', line 6 def parts @parts end |
Instance Method Details
#add_part(path, part) ⇒ Object
12 13 14 |
# File 'lib/open_xml_package.rb', line 12 def add_part(path, part) parts[path] = part end |
#write_to(path) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/open_xml_package.rb', line 16 def write_to(path) Zip::OutputStream.open(path) do |io| parts.each do |path, part| io.put_next_entry path io.write part.read end end end |