lib/relaton/db_cache.rb in relaton-1.7.0 vs lib/relaton/db_cache.rb in relaton-1.7.1

- old
+ new

@@ -63,11 +63,11 @@ # @return [String] def fetched(key) value = self[key] return unless value - if value =~ /^not_found/ + if value.match? /^not_found/ value.match(/\d{4}-\d{2}-\d{2}/).to_s else doc = Nokogiri::XML value doc.at("/bibitem/fetched|bibdata/fetched")&.text end @@ -157,11 +157,11 @@ # @param key [String] # @return [String] def filename(key) prefcode = key.downcase.match /^(?<prefix>[^\(]+)\((?<code>[^\)]+)/ fn = if prefcode - "#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/\()]/, '_').squeeze("_")}" + "#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/\()]/, '_').squeeze('_')}" else key.gsub(/[-:\s]/, "_") end "#{@dir}/#{fn.sub(/(,|_$)/, '')}" end @@ -216,10 +216,10 @@ # Initialse and return relaton instance, with local and global cache names # local_cache: local cache name; none created if nil; "relaton" created # if empty global_cache: boolean to create global_cache # flush_caches: flush caches - def init_bib_caches(opts) + def init_bib_caches(opts) # rubocop:disable Metrics/CyclomaticComplexity globalname = global_bibliocache_name if opts[:global_cache] localname = local_bibliocache_name(opts[:local_cache]) localname = "relaton" if localname&.empty? if opts[:flush_caches] FileUtils.rm_rf globalname unless globalname.nil?