Class: DigitalOceanInventory::Group
- Inherits:
-
Object
- Object
- DigitalOceanInventory::Group
- Defined in:
- lib/digital_ocean_inventory/group.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(host) ⇒ Object
-
#initialize(name, config, hosts = []) ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize(name, config, hosts = []) ⇒ Group
Returns a new instance of Group.
13 14 15 16 17 |
# File 'lib/digital_ocean_inventory/group.rb', line 13 def initialize(name, config, hosts = []) @name = name @config = config @hosts = hosts end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/digital_ocean_inventory/group.rb', line 3 def config @config end |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
3 4 5 |
# File 'lib/digital_ocean_inventory/group.rb', line 3 def hosts @hosts end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/digital_ocean_inventory/group.rb', line 3 def name @name end |
Class Method Details
.build(opts = {}) ⇒ Object
5 6 7 8 9 10 11 |
# 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 |
Instance Method Details
#<<(host) ⇒ Object
19 20 21 22 23 |
# File 'lib/digital_ocean_inventory/group.rb', line 19 def <<(host) return host if hosts.include? host.name @hosts << host end |