Class: Hosts
- Inherits:
-
Object
- Object
- Hosts
- Defined in:
- lib/vmfloaty/hosts.rb
Overview
manage hosts used from vm pooler
Instance Method Summary collapse
- #add_host(host_hash) ⇒ Object
-
#initialize ⇒ Hosts
constructor
A new instance of Hosts.
- #print_host_list ⇒ Object
- #remove_host(host_id) ⇒ Object
Constructor Details
#initialize ⇒ Hosts
Returns a new instance of Hosts.
3 4 5 |
# File 'lib/vmfloaty/hosts.rb', line 3 def initialize @host_list = {} end |
Instance Method Details
#add_host(host_hash) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vmfloaty/hosts.rb', line 7 def add_host(host_hash) host_hash.each do |k,v| if @host_list[k] @host_list[k].push(v) else if v.is_a?(Array) @host_list[k] = v else @host_list[k] = [v] end end end puts @host_list end |
#print_host_list ⇒ Object
26 27 28 |
# File 'lib/vmfloaty/hosts.rb', line 26 def print_host_list puts @host_list end |
#remove_host(host_id) ⇒ Object
23 24 |
# File 'lib/vmfloaty/hosts.rb', line 23 def remove_host(host_id) end |