Class: CapUtil::ServerRoles::RoleDef

Inherits:
Object
  • Object
show all
Defined in:
lib/cap-util/server_roles.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, servers_hash) ⇒ RoleDef

Returns a new instance of RoleDef.



45
46
47
48
49
50
# File 'lib/cap-util/server_roles.rb', line 45

def initialize(name, servers_hash)
  @name = name
  @servers = servers_hash.map do |(server_name, server_options_list)|
    ServerDef.new(server_name, server_options_list)
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



43
44
45
# File 'lib/cap-util/server_roles.rb', line 43

def name
  @name
end

#serversObject (readonly)

Returns the value of attribute servers.



43
44
45
# File 'lib/cap-util/server_roles.rb', line 43

def servers
  @servers
end

Instance Method Details

#apply(&block) ⇒ Object



52
53
54
55
56
# File 'lib/cap-util/server_roles.rb', line 52

def apply(&block)
  @servers.each do |server|
    block.call @name, server.hostname, server.options
  end
end