Module: ElasticQueue::Queueable

Extended by:
ActiveSupport::Concern
Defined in:
lib/elastic_queue/queueable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#index_for_queuesObject



49
50
51
# File 'lib/elastic_queue/queueable.rb', line 49

def index_for_queues
  self.class.queue_classes.each { |q| q.send(:upsert_model, self) }
end

#indexed_for_queueObject



39
40
41
42
43
44
45
46
47
# File 'lib/elastic_queue/queueable.rb', line 39

def indexed_for_queue
  index = { id: id, model: self.class.to_s.underscore }
  self.class.all_queue_attributes.each do |attr|
    val = send(attr)
    val = val.to_s(:db) if val.is_a? Date
    index[attr] = val
  end
  index
end

#remove_from_queue_indicesObject



53
54
55
# File 'lib/elastic_queue/queueable.rb', line 53

def remove_from_queue_indices
  self.class.queue_classes.each { |q| q.send(:remove_model, self) }
end