Class: Vixen::Model::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vixen/model/base.rb

Direct Known Subclasses

Host, Job, Snapshot, VM

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/vixen/model/base.rb', line 8

def initialize(handle)
  @handle = handle

  ObjectSpace.define_finalizer( self, self.class.finalize(handle) )
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



6
7
8
# File 'lib/vixen/model/base.rb', line 6

def handle
  @handle
end

Class Method Details

.finalize(handle) ⇒ Object



14
15
16
17
18
# File 'lib/vixen/model/base.rb', line 14

def self.finalize(handle)
  proc do
    Vixen::Bridge.destroy(handle)
  end
end

Instance Method Details

#get_string_property(property_id) ⇒ Object



20
21
22
# File 'lib/vixen/model/base.rb', line 20

def get_string_property(property_id)
  Vixen::Bridge.get_string_property handle, property_id
end