lxc-exporter/lib/lxc_extend.rb
2024-01-20 23:22:35 +01:00

23 lines
457 B
Ruby

require 'lxc'
module LXC
class <<self
def containers &exe
return to_enum __method__ unless block_given?
LXC.
list_containers.
map( &LXC::Container.method( :new)).
each &exe
end
def running_containers &exe
return to_enum __method__ unless block_given?
LXC.
list_containers.
map( &LXC::Container.method( :new)).
select( &:running?).
each &exe
end
end
end