class Ansible::Inventory::Host::Collection

Public Instance Methods

[](name) click to toggle source
# File lib/ansible/inventory.rb, line 114
def [](name)
  find {|host| host.name == name}
end
add(*args) click to toggle source
# 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