Class: Juniter::Element
- Inherits:
-
Object
- Object
- Juniter::Element
- Includes:
- HasAttributes, HasChildren
- Defined in:
- lib/juniter/element.rb
Direct Known Subclasses
TestCase, TestResult, TestSuite, TestSuiteProperty, TestSuites
Class Method Summary collapse
Instance Method Summary collapse
Methods included from HasChildren
#assign_children_from_xml, #children_xml, included
Methods included from HasAttributes
#assign_attributes_from_xml, included, #xml_attributes
Class Method Details
.from_xml(node) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/juniter/element.rb', line 15 def from_xml(node) new.tap do |element| element.assign_attributes_from_xml(node) element.assign_children_from_xml(node.nodes) end end |
.tag(*args) ⇒ Object
10 11 12 13 |
# File 'lib/juniter/element.rb', line 10 def tag(*args) @__tag = args.first.to_s unless args.none? @__tag end |
Instance Method Details
#to_xml ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/juniter/element.rb', line 23 def to_xml Ox::Element.new(tag).tap do |element| xml_attributes.each do |key, value| element[key.to_s] = value unless value.nil? end children_xml.each do |child| element << child end end end |