Class: OpenXml::Docx::Parts::Styles
- Inherits:
-
Part
- Object
- Part
- OpenXml::Docx::Parts::Styles
- Includes:
- RootNamespaces
- Defined in:
- lib/openxml/docx/parts/styles.rb
Constant Summary
Constants included from RootNamespaces
RootNamespaces::POSSIBLE_NAMESPACES
Instance Attribute Summary collapse
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
Instance Method Summary collapse
- #<<(style) ⇒ Object
-
#initialize ⇒ Styles
constructor
A new instance of Styles.
- #to_xml ⇒ Object
Methods included from RootNamespaces
Constructor Details
#initialize ⇒ Styles
Returns a new instance of Styles.
11 12 13 |
# File 'lib/openxml/docx/parts/styles.rb', line 11 def initialize @styles = [] end |
Instance Attribute Details
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
9 10 11 |
# File 'lib/openxml/docx/parts/styles.rb', line 9 def styles @styles end |
Instance Method Details
#<<(style) ⇒ Object
15 16 17 |
# File 'lib/openxml/docx/parts/styles.rb', line 15 def <<(style) @styles << style end |
#to_xml ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/openxml/docx/parts/styles.rb', line 19 def to_xml build_standalone_xml do |xml| xml.styles(root_namespaces) { xml.parent.namespace = :w add_default_styles(xml) styles.each { |style| style.to_xml(xml) } } end end |