Class: OpenXml::Docx::Parts::Header

Inherits:
Part
  • Object
show all
Includes:
RootNamespaces
Defined in:
lib/openxml/docx/parts/header.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

#initializeHeader

Returns a new instance of Header.


12
13
14
15
# File 'lib/openxml/docx/parts/header.rb', line 12

def initialize
  @children = []
  @relationships = OpenXml::Parts::Rels.new
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children


10
11
12
# File 'lib/openxml/docx/parts/header.rb', line 10

def children
  @children
end

#relationshipsObject (readonly)

Returns the value of attribute relationships


10
11
12
# File 'lib/openxml/docx/parts/header.rb', line 10

def relationships
  @relationships
end

Instance Method Details

#<<(child) ⇒ Object


17
18
19
# File 'lib/openxml/docx/parts/header.rb', line 17

def <<(child)
  children << child
end

#to_xmlObject


21
22
23
24
25
26
27
28
# File 'lib/openxml/docx/parts/header.rb', line 21

def to_xml
  build_xml do |xml|
    xml.hdr(root_namespaces) {
      xml.parent.namespace = :w
      children.each { |child| child.to_xml(xml) }
    }
  end
end