Class: OpenXml::Docx::Elements::Element

Inherits:
Object
  • Object
show all
Includes:
AttributeBuilder
Defined in:
lib/openxml/docx/elements/element.rb

Constant Summary

Constants included from AttributeBuilder

AttributeBuilder::VALID_THEME_COLORS, AttributeBuilder::VALID_TYPES

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttributeBuilder

#attributes, included, #render?

Class Attribute Details

.namespace(*args) ⇒ Object (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

.property_nameObject (readonly)

Returns the value of attribute property_name.



8
9
10
# File 'lib/openxml/docx/elements/element.rb', line 8

def property_name
  @property_name
end

Class Method Details

.name(*args) ⇒ Object



16
17
18
19
# File 'lib/openxml/docx/elements/element.rb', line 16

def name(*args)
  @property_name = args.first if args.any?
  @name
end

.tag(*args) ⇒ Object



11
12
13
14
# File 'lib/openxml/docx/elements/element.rb', line 11

def tag(*args)
  @tag = args.first if args.any?
  @tag
end

Instance Method Details

#nameObject



32
33
34
# File 'lib/openxml/docx/elements/element.rb', line 32

def name
  self.class.property_name || default_name
end

#namespaceObject



36
37
38
# File 'lib/openxml/docx/elements/element.rb', line 36

def namespace
  self.class.namespace || default_namespace
end

#tagObject



28
29
30
# File 'lib/openxml/docx/elements/element.rb', line 28

def tag
  self.class.tag || default_tag
end

#to_xml(xml) ⇒ Object



40
41
42
# File 'lib/openxml/docx/elements/element.rb', line 40

def to_xml(xml)
  xml[namespace].public_send(tag, xml_attributes)
end