Module: OpenXml::HasChildren
- Defined in:
- lib/openxml/has_children.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #<<(child) ⇒ Object
- #initialize ⇒ Object
- #push(child) ⇒ Object
- #render? ⇒ Boolean
- #to_xml(xml) ⇒ Object
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/openxml/has_children.rb', line 3 def children @children end |
Instance Method Details
#<<(child) ⇒ Object
9 10 11 |
# File 'lib/openxml/has_children.rb', line 9 def <<(child) children << child end |
#initialize ⇒ Object
5 6 7 |
# File 'lib/openxml/has_children.rb', line 5 def initialize @children = [] end |
#push(child) ⇒ Object
13 14 15 |
# File 'lib/openxml/has_children.rb', line 13 def push(child) children.push(child) end |
#render? ⇒ Boolean
26 27 28 |
# File 'lib/openxml/has_children.rb', line 26 def render? super || children.any? end |
#to_xml(xml) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/openxml/has_children.rb', line 17 def to_xml(xml) super(xml) do yield xml if block_given? children.each do |child| child.to_xml(xml) end end end |