6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/commonmeta/readers/commonmeta_reader.rb', line 6
def read_commonmeta(string: nil, **options)
if string.present?
errors = jsonlint(string)
return { "errors" => errors } if errors.present?
end
read_options = ActiveSupport::HashWithIndifferentAccess.new(options.except(:doi, :id, :url,
:sandbox, :validate, :ra))
meta = string.present? ? JSON.parse(string) : {}
meta["schema_version"] = "https://commonmeta.org/commonmeta_v0.10"
meta.compact.merge(read_options)
end
|