Method: Capistrano::Configuration::Servers#role_properties_for

Defined in:
lib/capistrano/configuration/servers.rb

#role_properties_for(rolenames) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/capistrano/configuration/servers.rb', line 37

def role_properties_for(rolenames)
  roles = rolenames.to_set
  rps = Set.new unless block_given?
  roles_for(rolenames).each do |host|
    host.roles.intersection(roles).each do |role|
      [host.properties.fetch(role)].flatten(1).each do |props|
        if block_given?
          yield host, role, props
        else
          rps << (props || {}).merge(role: role, hostname: host.hostname)
        end
      end
    end
  end
  block_given? ? nil : rps
end