Sha256: fc95c6fd5d297b160ef69f1fe0aa6b6506b2cbac36b9d1030b4c91f68abbf02e
Contents?: true
Size: 1.84 KB
Versions: 4
Compression:
Stored size: 1.84 KB
Contents
# This module has the primary QA search method. It also includes methods to process the linked data results and convert # them into the expected QA json results format. module Qa::Authorities module LinkedData class AuthorityService # Load or reload the linked data configuration files def self.load_authorities auth_cfg = {} # load QA configured linked data authorities Dir[File.join(Qa::Engine.root, 'config', 'authorities', 'linked_data', '*.json')].each do |fn| auth = File.basename(fn, '.json').upcase.to_sym json = File.read(File.expand_path(fn, __FILE__)) cfg = JSON.parse(json).deep_symbolize_keys auth_cfg[auth] = cfg end # load app configured linked data authorities and overrides Dir[Rails.root.join('config', 'authorities', 'linked_data', '*.json')].each do |fn| auth = File.basename(fn, '.json').upcase.to_sym json = File.read(File.expand_path(fn, __FILE__)) cfg = JSON.parse(json).deep_symbolize_keys auth_cfg[auth] = cfg end Qa.config.linked_data_authority_configs = auth_cfg end # Get the list of names of the loaded authorities # @return [Array<String>] all loaded authority configurations def self.authority_configs Qa.config.linked_data_authority_configs end # Get the configuration for an authority # @param [String] name of the authority # @return [Array<String>] configuration for the specified authority def self.authority_config(authname) authority_configs[authname] end # Get the list of names of the loaded authorities # @return [Array<String>] names of the authority config files that are currently loaded def self.authority_names authority_configs.keys.sort end end end end
Version data entries
4 entries across 4 versions & 1 rubygems