Class: WBEM::CIMElement

Inherits:
REXML::Element
  • Object
show all
Defined in:
lib/wbem/cim_xml.rb

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ CIMElement

“”“A base class that has a few bonus helper methods.”“”



53
54
55
# File 'lib/wbem/cim_xml.rb', line 53

def initialize(arg)
    super(arg)
end

Instance Method Details

#add_elements(children) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/wbem/cim_xml.rb', line 72

def add_elements(children)
    #"""Append a list or tuple of children."""
    unless children.is_a?(Array) or children.is_a?(Hash)
        children = [children]
    end
    children.each { |child| self.add_element(child) }
end

#add_optional_attribute(name, value) ⇒ Object



62
63
64
65
# File 'lib/wbem/cim_xml.rb', line 62

def add_optional_attribute(name, value)
    #"""Set an attribute if the value is not nil."""        
    self.add_attribute(name, value) unless value.nil?
end

#add_optional_element(child) ⇒ Object



67
68
69
70
# File 'lib/wbem/cim_xml.rb', line 67

def add_optional_element(child)
    #"""Append a child element which can be nil."""
    self.add_element(child) unless child.nil?
end

#setName(name) ⇒ Object



57
58
59
60
# File 'lib/wbem/cim_xml.rb', line 57

def setName(name)
    #"""Set the NAME attribute of the element."""
    self.add_attribute("NAME", name)
end

#toxmlObject



79
80
81
82
83
# File 'lib/wbem/cim_xml.rb', line 79

def toxml()
    outstr = ""
    self.write(outstr)
    outstr
end