14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/promiscuous/subscriber/lint/polymorphic.rb', line 14
def lint
super
return if skip_polymorphic
sub_descendants = subscriber.descendants
pub_descendants = publishers.select { |pub| pub < publisher }
if check_publisher
subscriber_types = sub_descendants.map &:from_type
publisher_types = pub_descendants.map &:class_name
missing_types = publisher_types - subscriber_types
if missing_types.present?
raise "#{subscriber} does not cover #{missing_types.join(", ")}"
end
end
sub_descendants.each do |pub|
self.class.new(options.merge(:klass => nil, :subscriber => pub,
:skip_polymorphic => true)).lint
end
end
|