Grooming.

master
Luka Vandervelden 2019-10-28 06:37:57 +01:00
parent 86f3294689
commit 3a3db5bde1
1 changed files with 9 additions and 11 deletions

View File

@ -26,6 +26,7 @@ module GenConfig
Array(String) | Array(Variables) |
Hash(String, String) | Hash(String, Variables) |
Array(Hash(String, String?)) |
Hash(String, Array(Hash(String, String?))) |
Hash(String, String?) |
Crinja::Callable::Instance
@ -96,23 +97,20 @@ class GenConfig::Context
options["service"] = service.to_genconfig
providers = Hash(String, Variables).new
service.providers.each do |token, provider|
options["providers"] = service.providers.compact_map do |token, provider|
provider = Service.get_by_id provider
next unless provider
providers[token] = provider.to_genconfig
provider.to_genconfig
end
options["providers"] = providers
consumers = Hash(String, Variables).new
service.provides.each do |provider_data|
token = provider_data.token
consumers[token] = service.get_consumers(token).map &.to_genconfig
end
options["consumers"] = consumers
options["consumers"] = service.provides
.map(&.token)
.map{ |token|
{token, service.get_consumers(token).map &.to_genconfig}
}
.to_h
end
end