Class: OpenXml::Builder::Element

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/openxml/builder/element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Element

Returns a new instance of Element.



6
7
8
# File 'lib/openxml/builder/element.rb', line 6

def initialize(*args)
  super Ox::Element.new(*args)
end

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



4
5
6
# File 'lib/openxml/builder/element.rb', line 4

def namespace
  @namespace
end

Instance Method Details

#[]=(attribute, value) ⇒ Object



10
11
12
13
14
# File 'lib/openxml/builder/element.rb', line 10

def []=(attribute, value)
  namespace_def = attribute.downcase.to_s.match(/^xmlns(?:\:(?<prefix>.*))?$/)
  namespaces << namespace_def[:prefix].to_sym if namespace_def && namespace_def[:prefix]
  super
end

#namespacesObject Also known as: namespace_definitions



26
27
28
# File 'lib/openxml/builder/element.rb', line 26

def namespaces
  @namespaces ||= []
end

#namespaces=(ns) ⇒ Object



22
23
24
# File 'lib/openxml/builder/element.rb', line 22

def namespaces=(ns)
  @namespaces = Array(ns)
end