Method: ActiveSupport::Notifications::Fanout#groups_for
- Defined in:
- activesupport/lib/active_support/notifications/fanout.rb
#groups_for(name) ⇒ Object
:nodoc:
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 187 def groups_for(name) # :nodoc: groups = @groups_for.compute_if_absent(name) do all_listeners_for(name).reject(&:silenceable).group_by(&:group_class).transform_values do |s| s.map(&:delegate) end end silenceable_groups = @silenceable_groups_for.compute_if_absent(name) do all_listeners_for(name).select(&:silenceable).group_by(&:group_class).transform_values do |s| s.map(&:delegate) end end unless silenceable_groups.empty? groups = groups.dup silenceable_groups.each do |group_class, subscriptions| active_subscriptions = subscriptions.reject { |s| s.silenced?(name) } unless active_subscriptions.empty? groups[group_class] = (groups[group_class] || []) + active_subscriptions end end end groups end |