lib/relaton_bipm/data_fetcher.rb in relaton-bipm-1.14.2 vs lib/relaton_bipm/data_fetcher.rb in relaton-bipm-1.14.3

- old
+ new

@@ -1,8 +1,8 @@ module RelatonBipm class DataFetcher - attr_reader :output, :format, :ext, :files, :index + attr_reader :output, :format, :ext, :files, :index, :index_new, :index2 # # Initialize fetcher # # @param [String] output output directory to save files @@ -13,10 +13,12 @@ @format = format @ext = format.sub(/^bib/, "") @files = [] @index_path = "index.yaml" @index = File.exist?(@index_path) ? YAML.load_file(@index_path) : {} + @index_new = Relaton::Index.find_or_create :BIPM, file: "index-bipm.yaml" + @index2 = Relaton::Index.find_or_create :BIPM, file: "index2.yaml" end # # Initialize fetcher and run fetching # @@ -43,10 +45,12 @@ case source when "bipm-data-outcomes" then DataOutcomesParser.parse(self) when "bipm-si-brochure" then BipmSiBrochureParser.parse(self) when "rawdata-bipm-metrologia" then RawdataBipmMetrologia::Fetcher.fetch(self) end - File.write @index_path, @index.to_yaml, encoding: "UTF-8" + File.write @index_path, index.to_yaml, encoding: "UTF-8" + index_new.save + index2.save end # # Save document to file #