lib/gutenberg_rdf/rdf.rb in gutenberg_rdf-0.1.0 vs lib/gutenberg_rdf/rdf.rb in gutenberg_rdf-0.2.1

- old
+ new

@@ -60,14 +60,11 @@ end def ebooks files = Array.new xml.elements.each('pgterms:file') do |file| - uri = file.attributes['about'] - datatypes = separate_mimetype_and_encoding(file.elements['dcterms:format/rdf:Description/rdf:value'].text) - modified = DateTime.parse(file.elements['dcterms:modified'].text + '-07:00') - files << {uri: uri, mime_type: datatypes[:mimetype], encoding: datatypes[:encoding], modified: modified} + files << Media.new(file) end files end private @@ -116,16 +113,9 @@ cover = node.text cover.sub!(/\Afile:\/\/\/public\/vhost\/g\/gutenberg\/html/, 'http://www.gutenberg.org') entries << cover end entries - end - - def separate_mimetype_and_encoding(string) - parts = string.split(/; */) - m = parts.shift - e = parts.join(';').sub('charset=', '') - {mimetype: m, encoding: e} end end end