lib/gutenberg_rdf/rdf.rb in gutenberg_rdf-1.0.0 vs lib/gutenberg_rdf/rdf.rb in gutenberg_rdf-1.0.1
- old
+ new
@@ -1,9 +1,11 @@
require 'date'
module GutenbergRdf
class Rdf
+ extend Gem::Deprecate
+
attr_reader :xml
def initialize(xml)
@xml = xml.root
end
@@ -46,10 +48,20 @@
def publisher
xml.elements['pgterms:ebook/dcterms:publisher'].text
end
def language
- xml.elements['pgterms:ebook/dcterms:language/rdf:Description/rdf:value'].text
+ # xml.elements['pgterms:ebook/dcterms:language/rdf:Description/rdf:value'].text
+ languages.first
+ end
+ deprecate :language, :languages, 2020, 7
+
+ def languages
+ langs = []
+ xml.elements.each('pgterms:ebook/dcterms:language') do |language|
+ langs << language.elements['rdf:Description/rdf:value'].text
+ end
+ langs
end
def rights
xml.elements['pgterms:ebook/dcterms:rights'].text
end