From 1c64196871d079b1301245332a2c6f913574d409 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 14 Jul 2020 19:25:27 +0200 Subject: [PATCH] use from with options --- lib/bolognese/metadata.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index 2fabaa2a..2a7f82ce 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -15,13 +15,13 @@ class Metadata :format, :funding_references, :state, :geo_locations, :types, :content_url, :related_identifiers, :style, :locale, :date_registered - def initialize(input: nil, from: nil, **options) + def initialize(input: nil, **options) options.symbolize_keys! id = normalize_id(input, options) ra = nil if id.present? - @from = from || find_from_format(id: id) + @from = options[:from] || find_from_format(id: id) # mEDRA, KISTI, JaLC and OP DOIs are found in the Crossref index if @from == "medra" @@ -51,7 +51,7 @@ def initialize(input: nil, from: nil, **options) "client_id" => options[:client_id], "content_url" => options[:content_url] } string = IO.read(input) - @from = from || find_from_format(string: string, filename: filename, ext: ext) + @from = options[:from] || find_from_format(string: string, filename: filename, ext: ext) else $stderr.puts "File type #{ext} not supported" exit 1 @@ -71,7 +71,7 @@ def initialize(input: nil, from: nil, **options) "publisher" => options[:publisher], "publication_year" => options[:publication_year] } string = input - @from = from || find_from_format(string: string) + @from = options[:from] || find_from_format(string: string) end # make sure input is encoded as utf8