lib/relaton_ieee/ieee_bibliography.rb in relaton-ieee-1.9.4 vs lib/relaton_ieee/ieee_bibliography.rb in relaton-ieee-1.10.0
- old
+ new
@@ -13,11 +13,11 @@
# @param year [String] the year the standard was published (optional)
# @param opts [Hash] options
#
# @return [Hash, NilClass] returns { ret: RelatonBib::BibliographicItem }
# if document is found else returns NilClass
- def get(code, year = nil, _opts = {})
+ def get(code, year = nil, _opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
warn "[relaton-ieee] (\"#{code}\") fetching..."
result = search(code) || (return nil)
year ||= code.match(/(?<=-)\d{4}/)&.to_s
ret = bib_results_filter(result, code, year)
if ret[:ret]
@@ -40,14 +40,14 @@
#
# @param result [RelatonIeee::HitCollection]
# @param opts [Hash] options
#
# @return [Hash]
- def bib_results_filter(result, ref, year)
+ def bib_results_filter(result, ref, year) # rubocop:disable Metrics/AbcSize
rp1 = ref_parts ref
missed_years = []
result.each do |hit|
- rp2 = ref_parts hit.hit["recordTitle"]
+ rp2 = ref_parts hit.hit[:ref]
next if rp1[:code] != rp2[:code] || rp1[:corr] != rp2[:corr]
return { ret: hit } if !year
return { ret: hit } if year.to_i == hit.hit[:year]