lib/bolognese/schema_org.rb in bolognese-0.6.6 vs lib/bolognese/schema_org.rb in bolognese-0.7

- old
+ new

@@ -12,10 +12,11 @@ @raw = doc.at_xpath('//script[@type="application/ld+json"]') end end alias_method :schema_org, :as_schema_org + alias_method :codemeta, :as_codemeta alias_method :bibtex, :as_bibtex def metadata @metadata ||= raw.present? ? Maremma.from_json(raw) : {} end @@ -59,14 +60,16 @@ def alternate_name metadata.fetch("alternateName", nil) end def author - Array(metadata.fetch("author", nil)).map { |a| a.except("name") }.presence + a = Array.wrap(metadata.fetch("author", nil)).map { |a| a.except("name") } + array_unwrap(a) end def editor - Array(metadata.fetch("editor", nil)).map { |a| a.except("name") }.presence + a = Array.wrap(metadata.fetch("editor", nil)).map { |a| a.except("name") } + array_unwrap(a) end def description metadata.fetch("description", nil) end