module OVIRT
  class BaseObject
    attr_accessor :id, :href, :name
    attr_reader :client

    def initialize(client, id, href, name)
      @id, @href, @name = id, href, name
      @client = client
      self
    end

    def parse_version xml
      (xml/'version').first[:major] +"."+ (xml/'version').first[:minor]
    end
  end
end
module OVIRT
  class BaseObject
    attr_accessor :id, :href, :name
    attr_reader :client

    def initialize(client, id, href, name)
      @id, @href, @name = id, href, name
      @client = client
      self
    end

    def parse_version xml
      (xml/'version').first[:major] +"."+ (xml/'version').first[:minor]
    end

    def parse_bool text
      return true if text =~ /^true$/i
      return false if text =~ /^false$/i
      raise ArgumentError.new %Q[The string "#{text}" isn't a valid boolean, it should be "true" or "false"]
    end
  end
end

Add method to parse XML booleans
Add method to parse XML booleans

Currently we don't convert boolean objects returned by the server to the
Ruby representation of booleans. This complicates further treatment of
these values, as they have to be treated as strings. To avoid that this
patch introduces a new "parse_bool" method in the base object class
intended to convert the boolean representation used by the server into
the Ruby representation. This method will be used in later changes.

Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>
