Class: SearchAndResque::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/search_and_resque/queue.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.queueObject

Returns the value of attribute queue.



4
5
6
# File 'lib/search_and_resque/queue.rb', line 4

def queue
  @queue
end

Class Method Details

.enqueue_delete(type_name, ids) ⇒ Object



19
20
21
22
23
# File 'lib/search_and_resque/queue.rb', line 19

def self.enqueue_delete(type_name, ids)
  unless ids.empty?
    Resque.enqueue(self, type_name, :delete!, ids)
  end
end

.enqueue_update(type_name, ids) ⇒ Object



13
14
15
16
17
# File 'lib/search_and_resque/queue.rb', line 13

def self.enqueue_update(type_name, ids)
  unless ids.empty?
    Resque.enqueue(self, type_name, :import!, ids)
  end
end

.perform(type_name, action, ids) ⇒ Object



7
8
9
10
11
# File 'lib/search_and_resque/queue.rb', line 7

def self.perform(type_name, action, ids)
  index = SearchAndResque.chewy_index
  type = index.types.find{ |t| t.type_name == type_name }
  type.send(action, ids)
end