class OVIRT::AffinityGroup

Attributes

enforcing[R]
name[R]
positive[R]

Public Class Methods

new(client, xml) click to toggle source
Calls superclass method
   # File lib/ovirt/affinity_group.rb
 6 def initialize(client, xml)
 7   super(client, xml[:id], xml[:href], (xml/'name').first.text)
 8   parse_xml_attributes!(xml)
 9   self
10 end
to_xml(opts={}) click to toggle source
   # File lib/ovirt/affinity_group.rb
12 def self.to_xml(opts={})
13    builder = Nokogiri::XML::Builder.new do
14     affinity_group_{
15       if opts[:name]
16         name_(opts[:name])
17       end
18       if opts[:positive]
19         positive_(opts[:positive])
20       end
21       if opts[:enforcing]
22         enforcing_(opts[:enforcing])
23       end
24     }
25    end
26    Nokogiri::XML(builder.to_xml).root.to_s
27 end

Public Instance Methods

parse_xml_attributes!(xml) click to toggle source
   # File lib/ovirt/affinity_group.rb
29 def parse_xml_attributes!(xml)
30  @name = (xml/'name').first.text
31  @positive = (xml/'positive').first.text if (xml/'positive')
32  @enforcing = (xml/'enforcing').first.text if (xml/'enforcing')
33  @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href]) rescue nil
34 end