Module: Libvirt

Defined in:
lib/libvirt-ext.rb

Defined Under Namespace

Classes: Connect, Domain

Class Method Summary collapse

Class Method Details

.connect(uri = nil, &e) ⇒ Object



23
24
25
# File 'lib/libvirt-ext.rb', line 23

def connect uri = nil, &e
	ensure_close_if_block_given open( uri), &e
end

.connect_read_only(uri = nil, &e) ⇒ Object



27
28
29
# File 'lib/libvirt-ext.rb', line 27

def connect_read_only uri = nil, &e
	ensure_close_if_block_given open_read_only( uri), &e
end

.ensure_close_if_block_given(c) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/libvirt-ext.rb', line 13

def ensure_close_if_block_given c
	if block_given?
		begin yield c
		ensure c.close
		end
	else
		c
	end
end