Class: Ansible::Inventory::Host::Collection
- Inherits:
-
Array
- Object
- Array
- Ansible::Inventory::Host::Collection
- Defined in:
- lib/ansible/inventory.rb
Instance Method Summary collapse
Instance Method Details
#[](name) ⇒ Object
114 115 116 |
# File 'lib/ansible/inventory.rb', line 114 def [](name) find {|host| host.name == name} end |
#add(*args) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/ansible/inventory.rb', line 100 def add(*args) host = if args.first.is_a?(Host) args.first else Host.new(*args) end # prevent dups if existing = self.find {|h| h == host} existing else self << host host end end |