lib/yt/annotations/for.rb in yt-annotations-1.2.1 vs lib/yt/annotations/for.rb in yt-annotations-1.2.2
- old
+ new
@@ -21,10 +21,11 @@
def xml_to_annotations(xml)
annotations = xml['document']['annotations']
annotations = Array.wrap (annotations || {})['annotation']
annotations = merge_highlights annotations
+ annotations = exclude_drawers annotations
annotations.map{|data| annotation_class(data).new data}
end
def annotation_class(data)
@@ -38,9 +39,13 @@
else case data['type']
when 'card' then Annotations::Card
when 'promotion' then Annotations::Featured
end
end
+ end
+
+ def exclude_drawers(annotations)
+ annotations.reject{|a| a['type'] == 'drawer'}
end
def merge_highlights(annotations)
highlights, others = annotations.partition{|a| a['type'] == 'highlight'}
highlights.each do |highlight|