Turn implicitly unique arrays into sets
This commit is contained in:
parent
cee7f7e174
commit
87baa5960c
@ -8,8 +8,8 @@ module Manifique
|
|||||||
|
|
||||||
def initialize(data={})
|
def initialize(data={})
|
||||||
self.url = data[:url]
|
self.url = data[:url]
|
||||||
self.from_web_manifest = []
|
self.from_web_manifest = Set.new
|
||||||
self.from_html = []
|
self.from_html = Set.new
|
||||||
self.icons = []
|
self.icons = []
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ module Manifique
|
|||||||
:theme_color, :background_color, :display,
|
:theme_color, :background_color, :display,
|
||||||
:start_url, :scope, :share_target ].map(&:to_s).each do |prop|
|
:start_url, :scope, :share_target ].map(&:to_s).each do |prop|
|
||||||
self.send("#{prop}=", manifest[prop]) if manifest[prop]
|
self.send("#{prop}=", manifest[prop]) if manifest[prop]
|
||||||
self.from_web_manifest.push(prop)
|
self.from_web_manifest.add(prop)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ module Manifique
|
|||||||
|
|
||||||
if title = @html.at_css("title") and !title.text.empty?
|
if title = @html.at_css("title") and !title.text.empty?
|
||||||
@metadata.name = title.text
|
@metadata.name = title.text
|
||||||
@metadata.from_html.push "name"
|
@metadata.from_html.add "name"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ module Manifique
|
|||||||
next if @metadata.send("#{prop}")
|
next if @metadata.send("#{prop}")
|
||||||
if value = get_meta_element_value(name)
|
if value = get_meta_element_value(name)
|
||||||
@metadata.send "#{prop}=", value
|
@metadata.send "#{prop}=", value
|
||||||
@metadata.from_html.push prop.to_s
|
@metadata.from_html.add prop.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -81,7 +81,7 @@ module Manifique
|
|||||||
return if @metadata.display
|
return if @metadata.display
|
||||||
if get_meta_element_value("apple-mobile-web-app-capable") == "yes"
|
if get_meta_element_value("apple-mobile-web-app-capable") == "yes"
|
||||||
@metadata.display = "standalone"
|
@metadata.display = "standalone"
|
||||||
@metadata.from_html.push "display"
|
@metadata.from_html.add "display"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -111,8 +111,6 @@ module Manifique
|
|||||||
icon["color"] = mask_icon_link.attributes["color"].value rescue nil
|
icon["color"] = mask_icon_link.attributes["color"].value rescue nil
|
||||||
@metadata.icons.push icon
|
@metadata.icons.push icon
|
||||||
end
|
end
|
||||||
|
|
||||||
@metadata.from_html.push "icons" unless @metadata.icons.empty?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_icon_type(src)
|
def get_icon_type(src)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user