lib/exlibris/aleph/tab_helper.rb in exlibris-aleph-0.1.2 vs lib/exlibris/aleph/tab_helper.rb in exlibris-aleph-0.1.3

- old
+ new

@@ -43,23 +43,24 @@ "NEDUC", "NHLTH", "NLINC", "NLAW", "NMUSI", "NSCI", "NUPTN"] # Initialize TabHelper based on path to tabs, path to store yml configs, # path for log file, and the ADMs for the Aleph implementation # Exlibris::Aleph::TabHelper.init("/mnt/aleph_tab", ["ADM50", "ADM51"]) - def self.init(tab_path, adms, refresh_time = ->{1.day.ago}) - @@tab_path, @@adms, @@refresh_time = tab_path, adms, refresh_time + def self.init(tab_path, adms, refresh_time = lambda{1.day.ago}) + @@tab_path, @@refresh_time = tab_path, refresh_time + @@adms = adms.collect{|adm| adm.downcase} unless adms.nil? # Set yml path and log path and make directories. @@yml_path, @@log_path = File.join(Rails.root, "config/aleph"), File.join(Rails.root, "log") - Dir.mkdir(@@yml_path) unless @@yml_path.nil? or Dir.exist?(@@yml_path) - Dir.mkdir(File.join(@@yml_path, "alephe")) unless @@yml_path.nil? or Dir.exist?(File.join(@@yml_path, "alephe")) + Dir.mkdir(@@yml_path) unless @@yml_path.nil? or File.directory?(@@yml_path) + Dir.mkdir(File.join(@@yml_path, "alephe")) unless @@yml_path.nil? or File.directory?(File.join(@@yml_path, "alephe")) @@adms.each { |adm| - Dir.mkdir(File.join(@@yml_path, adm)) unless @@yml_path.nil? or Dir.exist?(File.join(@@yml_path, adm)) + Dir.mkdir(File.join(@@yml_path, adm)) unless @@yml_path.nil? or File.directory?(File.join(@@yml_path, adm)) } unless @@adms.nil? - Dir.mkdir(@@log_path) unless @@log_path.nil? or Dir.exist?(@@log_path) + Dir.mkdir(@@log_path) unless @@log_path.nil? or File.directory?(@@log_path) # Make readers for each class variable class_variables.each do |class_variable| define_method "#{class_variable}".sub('@@', '') do - self.class.class_variable_get "#{class_variable}" + self.class.send(:class_variable_get, "#{class_variable}") end end end # Sets class variable of irrelevant sub libraries to be ignored when building sub_libraries YAML \ No newline at end of file