lib/bolognese/utils.rb in bolognese-0.8.11 vs lib/bolognese/utils.rb in bolognese-0.8.12
- old
+ new
@@ -49,16 +49,14 @@
"codemeta"
end
end
def read(id: nil, string: nil, from: nil, **options)
- if from.nil?
- puts "not implemented"
- return nil
- end
-
p = case from
+ when nil
+ puts "not implemented"
+ return nil
when "crossref" then Crossref.new(id: id, string: string)
when "datacite" then Datacite.new(id: id, string: string, regenerate: options[:regenerate])
when "codemeta" then Codemeta.new(id: id, string: string)
when "datacite_json" then DataciteJson.new(string: string)
when "citeproc" then Citeproc.new(id: id, string: string)
@@ -77,9 +75,16 @@
def write(id: nil, string: nil, from: nil, to: nil, **options)
metadata = read(id: id, string: string, from: from, **options)
return nil if metadata.nil?
puts metadata.send(to)
+ end
+
+ def generate(id: nil, string: nil, from: nil, to: nil, **options)
+ metadata = read(id: id, string: string, from: from, **options)
+ return nil if metadata.nil?
+
+ metadata.send(to)
end
def orcid_from_url(url)
Array(/\Ahttp:\/\/orcid\.org\/(.+)/.match(url)).last
end