Module: ElasticQueue::Queueable::ClassMethods

Defined in:
lib/elastic_queue/queueable.rb

Instance Method Summary collapse

Instance Method Details

#all_queue_attributesObject

the union of analyzed and not_analyzed attributes



32
33
34
# File 'lib/elastic_queue/queueable.rb', line 32

def all_queue_attributes
  @queue_attributes.to_a | @not_analyzed_queue_attributes.to_a
end

#not_analyzed_queue_attributes(*attributes) ⇒ Object



27
28
29
# File 'lib/elastic_queue/queueable.rb', line 27

def not_analyzed_queue_attributes(*attributes)
  @not_analyzed_queue_attributes ||= attributes
end

#queue_attributes(*attributes) ⇒ Object Also known as: analyzed_queue_attributes



21
22
23
# File 'lib/elastic_queue/queueable.rb', line 21

def queue_attributes(*attributes)
  @queue_attributes ||= attributes
end

#queue_classesObject



17
18
19
# File 'lib/elastic_queue/queueable.rb', line 17

def queue_classes
  queues.map { |q| q.to_s.camelize.constantize }
end

#queue_mappingObject



36
37
38
39
40
41
42
43
# File 'lib/elastic_queue/queueable.rb', line 36

def queue_mapping
  return if @not_analyzed_queue_attributes.blank?
  properties = {}
  @not_analyzed_queue_attributes.each do |a|
    properties[a.to_sym] = { type: :string, index: :not_analyzed }
  end
  { to_s.underscore.to_sym => { properties: properties } }
end

#queues(*queues) ⇒ Object



13
14
15
# File 'lib/elastic_queue/queueable.rb', line 13

def queues(*queues)
  @queues ||= queues
end