Class: OpenXml::Element
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#attributes, included, #render?
Class Attribute Details
.namespace(*args) ⇒ Object
Returns the value of attribute namespace.
9
10
11
|
# File 'lib/openxml/element.rb', line 9
def namespace
@namespace
end
|
.property_name ⇒ Object
Returns the value of attribute property_name.
8
9
10
|
# File 'lib/openxml/element.rb', line 8
def property_name
@property_name
end
|
Class Method Details
.name(*args) ⇒ Object
16
17
18
19
|
# File 'lib/openxml/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/element.rb', line 11
def tag(*args)
@tag = args.first if args.any?
@tag
end
|
Instance Method Details
#name ⇒ Object
32
33
34
|
# File 'lib/openxml/element.rb', line 32
def name
self.class.property_name || default_name
end
|
#namespace ⇒ Object
36
37
38
|
# File 'lib/openxml/element.rb', line 36
def namespace
([self.class] + self.class.ancestors).select { |klass| klass.respond_to?(:namespace) }.map(&:namespace).find(&:itself)
end
|
#tag ⇒ Object
28
29
30
|
# File 'lib/openxml/element.rb', line 28
def tag
self.class.tag || default_tag
end
|
#to_xml(xml) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/openxml/element.rb', line 40
def to_xml(xml)
raise UndefinedNamespaceError, self.class unless namespace
xml[namespace].public_send(tag, xml_attributes) do
yield xml if block_given?
end
end
|