Class: Virt::Connection
- Inherits:
-
Object
- Object
- Virt::Connection
- Defined in:
- lib/virt/connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #closed? ⇒ Boolean
- #disconnect ⇒ Object
- #host ⇒ Object
-
#initialize(uri) ⇒ Connection
constructor
A new instance of Connection.
- #secure? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(uri) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 |
# File 'lib/virt/connection.rb', line 6 def initialize uri raise("Must provide a guest to connect to") unless uri @connection = Libvirt::open uri end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
4 5 6 |
# File 'lib/virt/connection.rb', line 4 def connection @connection end |
Instance Method Details
#closed? ⇒ Boolean
11 12 13 |
# File 'lib/virt/connection.rb', line 11 def closed? connection.closed? end |
#disconnect ⇒ Object
23 24 25 |
# File 'lib/virt/connection.rb', line 23 def disconnect connection.close end |
#host ⇒ Object
27 28 29 |
# File 'lib/virt/connection.rb', line 27 def host Host.new end |
#secure? ⇒ Boolean
15 16 17 |
# File 'lib/virt/connection.rb', line 15 def secure? connection.encrypted? end |
#version ⇒ Object
19 20 21 |
# File 'lib/virt/connection.rb', line 19 def version connection.libversion end |