module Fog::Libvirt::Util

Public Instance Methods

randomized_name() click to toggle source
# File lib/fog/libvirt/models/compute/util/util.rb, line 19
def randomized_name
  "fog-#{(SecureRandom.random_number*10E14).to_i.round}"
end
xml_element(xml, path, attribute=nil) click to toggle source
# File lib/fog/libvirt/models/compute/util/util.rb, line 9
def xml_element(xml, path, attribute=nil)
  xml = Nokogiri::XML(xml)
  attribute.nil? ? (xml/path).first.text : (xml/path).first[attribute.to_sym]
end
xml_elements(xml, path, attribute=nil) click to toggle source
# File lib/fog/libvirt/models/compute/util/util.rb, line 14
def xml_elements(xml, path, attribute=nil)
  xml = Nokogiri::XML(xml)
  attribute.nil? ? (xml/path).map : (xml/path).map{|element| element[attribute.to_sym]}
end