Class: OpenXml::Docx::Parts::Styles

Inherits:
Part
  • Object
show all
Includes:
RootNamespaces
Defined in:
lib/openxml/docx/parts/styles.rb

Constant Summary

Constants included from RootNamespaces

RootNamespaces::POSSIBLE_NAMESPACES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RootNamespaces

included

Constructor Details

#initializeStyles

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

#stylesObject (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_xmlObject


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