Class: OpenXml::Docx::Elements::Container

Inherits:
Element
  • Object
show all
Includes:
PropertyBuilder
Defined in:
lib/openxml/docx/elements/container.rb

Constant Summary

Constants included from AttributeBuilder

AttributeBuilder::VALID_THEME_COLORS, AttributeBuilder::VALID_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PropertyBuilder

included, #property_xml

Methods inherited from Element

#name, name, #namespace, tag, #tag

Methods included from AttributeBuilder

#attributes, included, #render?

Constructor Details

#initializeContainer

Returns a new instance of Container.



9
10
11
# File 'lib/openxml/docx/elements/container.rb', line 9

def initialize
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



7
8
9
# File 'lib/openxml/docx/elements/container.rb', line 7

def children
  @children
end

Instance Method Details

#<<(child) ⇒ Object



13
14
15
# File 'lib/openxml/docx/elements/container.rb', line 13

def <<(child)
  children << child
end

#to_xml(xml) ⇒ Object



17
18
19
20
21
22
# File 'lib/openxml/docx/elements/container.rb', line 17

def to_xml(xml)
  xml[namespace].public_send(tag, xml_attributes) {
    property_xml(xml)
    children.each { |child| child.to_xml(xml) }
  }
end