Method: Webhookdb::Replicator.load_replicators

Defined in:
lib/webhookdb/replicator.rb

.load_replicatorsObject



177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/webhookdb/replicator.rb', line 177

def load_replicators
  existing_descendants = Webhookdb::Replicator::Base.descendants
  ["replicator", PLUGIN_DIRNAME].each do |d|
    Gem.find_files(File.join("webhookdb/#{d}/*.rb")).each do |path|
      next if path.include?("/spec/")
      require path
    end
  end
  new_descendants = Webhookdb::Replicator::Base.descendants
  newly_registered = new_descendants - existing_descendants
  newly_registered.each { |cls| self.register(cls) }
  return newly_registered
end