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, line 6 def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) self end
to_xml(opts={})
click to toggle source
# File lib/ovirt/affinity_group.rb, line 12 def self.to_xml(opts={}) builder = Nokogiri::XML::Builder.new do affinity_group_{ if opts[:name] name_(opts[:name]) end if opts[:positive] positive_(opts[:positive]) end if opts[:enforcing] enforcing_(opts[:enforcing]) end } end Nokogiri::XML(builder.to_xml).root.to_s end
Public Instance Methods
parse_xml_attributes!(xml)
click to toggle source
# File lib/ovirt/affinity_group.rb, line 29 def parse_xml_attributes!(xml) @name = (xml/'name').first.text @positive = (xml/'positive').first.text if (xml/'positive') @enforcing = (xml/'enforcing').first.text if (xml/'enforcing') @cluster = Link::new(@client, (xml/'cluster').first[:id], (xml/'cluster').first[:href]) rescue nil end