Class: OpenXml::Builder::Element
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OpenXml::Builder::Element
- Defined in:
- lib/openxml/builder/element.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #[]=(attribute, value) ⇒ Object
- #ancestors ⇒ Object
-
#initialize(*args) ⇒ Element
constructor
A new instance of Element.
- #namespaces ⇒ Object (also: #namespace_definitions)
Constructor Details
#initialize(*args) ⇒ Element
7 8 9 |
# File 'lib/openxml/builder/element.rb', line 7 def initialize(*args) super Ox::Element.new(*args) end |
Instance Attribute Details
#namespace ⇒ Object
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/openxml/builder/element.rb', line 4 def namespace @namespace end |
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/openxml/builder/element.rb', line 5 def parent @parent end |
Instance Method Details
#[]=(attribute, value) ⇒ Object
11 12 13 14 15 |
# File 'lib/openxml/builder/element.rb', line 11 def []=(attribute, value) namespace_def = attribute.downcase.to_s.match /^xmlns(?:\:(?<prefix>.*))?$/ add_namespace(namespace_def[:prefix], value.to_s) if namespace_def super end |
#ancestors ⇒ Object
29 30 31 32 33 |
# File 'lib/openxml/builder/element.rb', line 29 def ancestors parents = [self] parents << parent.ancestors unless parent.nil? || !parent.respond_to?(:ancestors) parents.flatten end |
#namespaces ⇒ Object Also known as: namespace_definitions
24 25 26 |
# File 'lib/openxml/builder/element.rb', line 24 def namespaces @namespaces ||= [] end |