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



55
56
57
# File 'lib/elastic_queue/queueable.rb', line 55

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

#indexed_for_queueObject



45
46
47
48
49
50
51
52
53
# File 'lib/elastic_queue/queueable.rb', line 45

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



59
60
61
# File 'lib/elastic_queue/queueable.rb', line 59

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