Class: Rocx::Package
- Inherits:
-
Object
- Object
- Rocx::Package
- Defined in:
- lib/rocx/package.rb
Instance Attribute Summary collapse
-
#content_types ⇒ Object
readonly
Returns the value of attribute content_types.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#global_rels ⇒ Object
readonly
Returns the value of attribute global_rels.
-
#rels ⇒ Object
readonly
Returns the value of attribute rels.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
Instance Method Summary collapse
-
#initialize ⇒ Package
constructor
A new instance of Package.
- #save(path) ⇒ Object
Constructor Details
#initialize ⇒ Package
Returns a new instance of Package.
12 13 14 15 16 17 18 19 |
# File 'lib/rocx/package.rb', line 12 def initialize @content_types = Rocx::Parts::ContentTypes.new @document = Rocx::Parts::Document.new @global_rels = Rocx::Parts::GlobalRels.new @rels = Rocx::Parts::Rels.new @settings = Rocx::Parts::Settings.new @styles = Rocx::Parts::Styles.new end |
Instance Attribute Details
#content_types ⇒ Object (readonly)
Returns the value of attribute content_types.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def content_types @content_types end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def document @document end |
#global_rels ⇒ Object (readonly)
Returns the value of attribute global_rels.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def global_rels @global_rels end |
#rels ⇒ Object (readonly)
Returns the value of attribute rels.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def rels @rels end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def settings @settings end |
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
5 6 7 |
# File 'lib/rocx/package.rb', line 5 def styles @styles end |
Instance Method Details
#save(path) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rocx/package.rb', line 21 def save(path) package = OpenXmlPackage.new package.add_part "_rels/.rels", global_rels package.add_part "[Content_Types].xml", content_types package.add_part "word/_rels/document.xml.rels", rels package.add_part "word/document.xml", document package.add_part "word/settings.xml", settings package.add_part "word/styles.xml", styles package.write_to path end |