lib/apple-news/component.rb in apple-news-0.1.1 vs lib/apple-news/component.rb in apple-news-0.2.0
- old
+ new
@@ -8,14 +8,18 @@
module AppleNews
module Component
extend self
def factory(data)
+ return if data.nil?
+
components.each do |component|
if component.role == data[:role]
return component.new(data)
end
end
+
+ nil
end
private
def components