Module: Esse::AsyncIndexing::Jobs

Defined in:
lib/esse/async_indexing.rb,
lib/esse/async_indexing/testing.rb

Defined Under Namespace

Classes: BulkUpdateLazyDocumentAttributeJob, DocumentDeleteByIdJob, DocumentIndexByIdJob, DocumentUpdateByIdJob, DocumentUpsertByIdJob, ImportAllJob, ImportBatchIdJob, UpdateLazyDocumentAttributeJob

Class Method Summary collapse

Class Method Details

.clearObject



39
40
41
# File 'lib/esse/async_indexing/testing.rb', line 39

def clear
  jobs.clear
end

.jobsObject



31
32
33
# File 'lib/esse/async_indexing/testing.rb', line 31

def jobs
  @jobs ||= []
end

.jobs_for(service: nil, class_name: nil) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/esse/async_indexing/testing.rb', line 47

def jobs_for(service: nil, class_name: nil)
  filtered = jobs
  if service
    filtered = filtered.select { |job| job["service"] == service.to_s }
  end
  if class_name
    filtered = filtered.select { |job| job["__class_name__"] == class_name.to_s }
  end
  filtered
end

.push(job) ⇒ Object



35
36
37
# File 'lib/esse/async_indexing/testing.rb', line 35

def push(job)
  jobs.push(job)
end

.sizeObject



43
44
45
# File 'lib/esse/async_indexing/testing.rb', line 43

def size
  jobs.size
end