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

.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



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

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

.namespace(*args) ⇒ Object



20
21
22
23
# File 'lib/openxml/docx/elements/element.rb', line 20

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

.tag(*args) ⇒ Object



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

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

Instance Method Details

#nameObject



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

def name
  self.class.property_name || default_name
end

#namespaceObject



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

def namespace
  self.class.namespace || default_namespace
end

#tagObject



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

def tag
  self.class.tag || default_tag
end

#to_xml(xml) ⇒ Object



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

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