class DigitalOceanInventory::Group

Attributes

config[R]
hosts[R]
name[R]

Public Class Methods

build(opts = {}) click to toggle source
# File lib/digital_ocean_inventory/group.rb, line 5
def self.build(opts = {})
  name   = opts[:name]
  config = opts[:config]
  hosts  = opts[:hosts] || []

  new name, config, hosts
end
new(name, config, hosts = []) click to toggle source
# File lib/digital_ocean_inventory/group.rb, line 13
def initialize(name, config, hosts = [])
  @name   = name
  @config = config
  @hosts  = hosts
end

Public Instance Methods

<<(host) click to toggle source
# File lib/digital_ocean_inventory/group.rb, line 19
def <<(host)
  return host if hosts.include? host.name

  @hosts << host
end