Class: OpenXml::Docx::Parts::Styles
- Inherits:
-
Part
- Object
- Part
- OpenXml::Docx::Parts::Styles
- Defined in:
- lib/openxml/docx/parts/styles.rb
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
Constructor Details
#initialize ⇒ Styles
Returns a new instance of Styles.
7 8 9 |
# File 'lib/openxml/docx/parts/styles.rb', line 7 def initialize @styles = [] end |
Instance Attribute Details
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
5 6 7 |
# File 'lib/openxml/docx/parts/styles.rb', line 5 def styles @styles end |
Instance Method Details
#<<(style) ⇒ Object
11 12 13 |
# File 'lib/openxml/docx/parts/styles.rb', line 11 def <<(style) @styles << style end |
#to_xml ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/openxml/docx/parts/styles.rb', line 15 def to_xml build_standalone_xml do |xml| xml.styles(root_namespaces) { xml.parent.namespace = xml.parent.namespace_definitions.find { |ns| ns.prefix == "w" } add_default_styles(xml) styles.each { |style| style.to_xml(xml) } } end end |