Skip to content

Commit

Permalink
use from with options
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 14, 2020
1 parent 3ead12e commit 1c64196
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/bolognese/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1c64196

Please sign in to comment.