Grooming.
This commit is contained in:
parent
c80360e380
commit
36829e8664
@ -116,14 +116,7 @@ class GenConfig::Context
|
||||
service.provides.each do |provider_data|
|
||||
token = provider_data.token
|
||||
|
||||
# FIXME: definitely unreadable
|
||||
consumers[token] = Service.all
|
||||
.select(
|
||||
&.providers.select do |t, provider|
|
||||
t == token && service.is_id?(provider)
|
||||
end
|
||||
.size.>(0))
|
||||
.map &.to_genconfig
|
||||
consumers[token] = service.get_consumers(token).map &.to_genconfig
|
||||
end
|
||||
options["consumers"] = consumers
|
||||
end
|
||||
|
@ -441,6 +441,16 @@ class Service
|
||||
def get_default_provider(token) : String?
|
||||
@environment.get_provider(token) || Environment.root.get_provider(token)
|
||||
end
|
||||
|
||||
def consumes?(token, origin)
|
||||
providers.select do |_token, provider|
|
||||
token == _token && origin.is_id?(provider)
|
||||
end.size > 0
|
||||
end
|
||||
|
||||
def get_consumers(token)
|
||||
Service.all.select(&.consumes?(token, self))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user