Module: Fog::Libvirt::Util
- Included in:
- Compute::Network, Compute::Server, Compute::Shared, Compute::Volume
- Defined in:
- lib/fog/libvirt/models/compute/util/uri.rb,
lib/fog/libvirt/models/compute/util/util.rb
Defined Under Namespace
Classes: URI
Instance Method Summary collapse
- #randomized_name ⇒ Object
- #xml_element(xml, path, attribute = nil) ⇒ Object
- #xml_elements(xml, path, attribute = nil) ⇒ Object
Instance Method Details
#randomized_name ⇒ Object
17 18 19 |
# File 'lib/fog/libvirt/models/compute/util/util.rb', line 17 def randomized_name "fog-#{(SecureRandom.random_number*10E14).to_i.round}" end |
#xml_element(xml, path, attribute = nil) ⇒ Object
7 8 9 10 |
# File 'lib/fog/libvirt/models/compute/util/util.rb', line 7 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) ⇒ Object
12 13 14 15 |
# File 'lib/fog/libvirt/models/compute/util/util.rb', line 12 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 |