diff --git a/lib/anystyle/feature/position.rb b/lib/anystyle/feature/position.rb index 1c2a41b..bd0e00a 100644 --- a/lib/anystyle/feature/position.rb +++ b/lib/anystyle/feature/position.rb @@ -4,7 +4,7 @@ class Position < Feature attr_reader :idx, :seq def initialize(idx: :idx, seq: :seq, **opts) - super(opts) + super(**opts) @idx, @seq = idx, seq end diff --git a/lib/anystyle/parser.rb b/lib/anystyle/parser.rb index 25cba79..0f25337 100644 --- a/lib/anystyle/parser.rb +++ b/lib/anystyle/parser.rb @@ -87,12 +87,12 @@ def prepare(input, **opts) expand Wapiti::Dataset.new([input]) when String if !input.tainted? && input.length < 1024 && File.exists?(input) - expand Wapiti::Dataset.open(input, opts) + expand Wapiti::Dataset.open(input, **opts) else - expand Wapiti::Dataset.parse(input, opts) + expand Wapiti::Dataset.parse(input, **opts) end else - expand Wapiti::Dataset.parse(input, opts) + expand Wapiti::Dataset.parse(input, **opts) end end end @@ -207,7 +207,7 @@ def prepare(input, **opts) opts[:separator] ||= options[:separator] opts[:delimiter] ||= options[:delimiter] input = input.join("\n") if input.is_a?(Array) && input[0].is_a?(String) - super(input, opts) + super(input, **opts) end end end diff --git a/spec/anystyle/dictionary/gdbm_spec.rb b/spec/anystyle/dictionary/gdbm_spec.rb index 25af71f..35b4f0e 100644 --- a/spec/anystyle/dictionary/gdbm_spec.rb +++ b/spec/anystyle/dictionary/gdbm_spec.rb @@ -2,6 +2,7 @@ begin require 'gdbm' + require 'tmpdir' module AnyStyle describe "GDBM Dictionary Adapter" do diff --git a/spec/anystyle/normalizer/arxiv_spec.rb b/spec/anystyle/normalizer/arxiv_spec.rb index 106e602..d0664e2 100644 --- a/spec/anystyle/normalizer/arxiv_spec.rb +++ b/spec/anystyle/normalizer/arxiv_spec.rb @@ -7,7 +7,7 @@ module AnyStyle 'Preprint, arXiv:1402.7034,' => { arxiv: ['1402.7034'] }, '[arXiv:hepph/9905221].' => { arxiv: ['hepph/9905221'] } }).each do |(a, b)| - expect(n.normalize(note: [a])).to include(b) + expect(n.normalize({ note: [a] })).to include(b) end end end diff --git a/spec/anystyle/normalizer/locator_spec.rb b/spec/anystyle/normalizer/locator_spec.rb index 40f9233..a38c8c9 100644 --- a/spec/anystyle/normalizer/locator_spec.rb +++ b/spec/anystyle/normalizer/locator_spec.rb @@ -10,7 +10,7 @@ module AnyStyle 'doi:10.1002/mpr.33.' => { doi: ['10.1002/mpr.33.'] }, 'https://doi.org/10.1000/182' => { doi: ['10.1000/182'] } }).each do |(a, b)| - expect(n.normalize(doi: [a])).to include(b) + expect(n.normalize({ doi: [a] })).to include(b) end end @@ -19,7 +19,7 @@ module AnyStyle 'https://doi.org/10/aabbe' => { doi: ['10/aabbe'] }, 'https://doi.org/10.1000/182' => { doi: ['10.1000/182'] } }).each do |(a, b)| - expect(n.normalize(url: [a])).to include(b) + expect(n.normalize({ url: [a] })).to include(b) end end end diff --git a/spec/anystyle/normalizer/volume_spec.rb b/spec/anystyle/normalizer/volume_spec.rb index 056235b..4f0681f 100644 --- a/spec/anystyle/normalizer/volume_spec.rb +++ b/spec/anystyle/normalizer/volume_spec.rb @@ -48,20 +48,22 @@ module AnyStyle '22. Jg. Heft 3,' => { volume: ['22'], issue: ['3'] }, '19.Jg. H.3,' => { volume: ['19'], issue: ['3'] }, 'Jg. 37:' => { volume: ['37'] } - + # 47ème année, n°1, # Isuue 140, # 40 (4), art. no. 5446343, # 129, 4, Pt. 2: }).each do |(a, b)| - expect(n.normalize(volume: [a])).to include(b), - -> { "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s } + expect(n.normalize({ volume: [a] })) + .to include(b), -> { + "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s + } end end it "extracts number of volumes" do - expect(n.normalize(volume: ['8 vols.'])).to include(volume: ['8']) + expect(n.normalize({ volume: ['8 vols.'] })).to include(volume: ['8']) end it "extracts page numbers" do @@ -71,8 +73,10 @@ module AnyStyle # '22(3):pp.87-106' => { volume: ['22'], issue: ['3'], pages: ['87-106'] }, # '35:S42-S45' => { volume: ['35'], pages: ['42-45'] } }).each do |(a, b)| - expect(n.normalize(volume: [a])).to include(b), - ->{ "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s } + expect(n.normalize({ volume: [a] })) + .to include(b), -> { + "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s + } end end @@ -87,8 +91,10 @@ module AnyStyle '19 Jg., Heft 2/2011,' => { volume: ['19'], issue: ['2'], date: ['2011'] }, 'Jg. 51, Heft 3/2000,' => { volume: ['51'], issue: ['3'], date: ['2000'] } }).each do |(a, b)| - expect(n.normalize(volume: [a])).to include(b), - ->{ "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s } + expect(n.normalize({ volume: [a] })) + .to include(b), -> { + "'#{a}' should normalise to #{b}, got: " + n.normalize(volume: [a]).to_s + } end end end