lib/rocket_job/dirmon_entry.rb in rocketjob-3.2.1 vs lib/rocket_job/dirmon_entry.rb in rocketjob-3.3.0

- old
+ new

@@ -144,31 +144,31 @@ # that they are not tampered with # # Default: [] ==> Do not enforce whitelists # # Returns [Array<String>] a copy of the whitelisted paths - def self.whitelist_paths - @@whitelist_paths.dup + def self.get_whitelist_paths + self.whitelist_paths.dup end # Add a path to the whitelist # Raises: Errno::ENOENT: No such file or directory def self.add_whitelist_path(path) # Confirms that path exists path = Pathname.new(path).realpath.to_s - @@whitelist_paths << path - @@whitelist_paths.uniq! + self.whitelist_paths << path + self.whitelist_paths.uniq! path end # Deletes a path from the whitelist paths # Raises: Errno::ENOENT: No such file or directory def self.delete_whitelist_path(path) # Confirms that path exists path = Pathname.new(path).realpath.to_s - @@whitelist_paths.delete(path) - @@whitelist_paths.uniq! + self.whitelist_paths.delete(path) + self.whitelist_paths.uniq! path end # Returns [Hash<String:Integer>] of the number of dirmon entries in each state. # Note: If there are no workers in that particular state then the hash will not have a value for it. @@ -201,13 +201,13 @@ counts end # The default archive directory that is used when the job being queued does not respond # to #upload, and does not have an `archive_directory` specified in this entry - cattr_accessor :default_archive_directory + class_attribute :default_archive_directory - @@default_archive_directory = '_archive'.freeze + self.default_archive_directory = '_archive'.freeze # Returns [Pathname] the archive_directory if set, otherwise the default_archive_directory # Creates the archive directory if one is set def archive_pathname(file_pathname) if archive_directory @@ -264,12 +264,10 @@ worker_name: worker_name ) end end - @@whitelist_paths = Concurrent::Array.new - # Returns the Job to be queued def job_class return if job_class_name.nil? job_class_name.constantize rescue NameError @@ -290,13 +288,11 @@ end end private - # Instance method to return whitelist paths - def whitelist_paths - @@whitelist_paths - end + class_attribute :whitelist_paths + self.whitelist_paths = Concurrent::Array.new # Upload the file to the job def upload_file(job, pathname) if job.respond_to?(:upload) # With RocketJob Pro the file can be uploaded directly into the Job itself