Class: OVIRT::BaseObject
- Inherits:
-
Object
- Object
- OVIRT::BaseObject
- Defined in:
- lib/ovirt/base_object.rb
Direct Known Subclasses
AffinityGroup, Cluster, DataCenter, DiskProfile, Host, InstanceType, Interface, Network, OperatingSystem, Quota, StorageDomain, Template, VM, Volume
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#href ⇒ Object
Returns the value of attribute href.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(client, id, href, name) ⇒ BaseObject
constructor
A new instance of BaseObject.
- #parse_bool(text) ⇒ Object
- #parse_version(xml) ⇒ Object
Constructor Details
#initialize(client, id, href, name) ⇒ BaseObject
Returns a new instance of BaseObject.
6 7 8 9 10 |
# File 'lib/ovirt/base_object.rb', line 6 def initialize(client, id, href, name) @id, @href, @name = id, href, name @client = client self end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/ovirt/base_object.rb', line 4 def client @client end |
#href ⇒ Object
Returns the value of attribute href.
3 4 5 |
# File 'lib/ovirt/base_object.rb', line 3 def href @href end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ovirt/base_object.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ovirt/base_object.rb', line 3 def name @name end |
Instance Method Details
#parse_bool(text) ⇒ Object
16 17 18 19 20 |
# File 'lib/ovirt/base_object.rb', line 16 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 |
#parse_version(xml) ⇒ Object
12 13 14 |
# File 'lib/ovirt/base_object.rb', line 12 def parse_version xml (xml/'version').first[:major] +"."+ (xml/'version').first[:minor] end |