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



25
26
27
# File 'lib/elastic_queue/queueable.rb', line 25

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

#not_analyzed_queue_attributes(*attributes) ⇒ Object



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

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

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



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

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

#queue_classesObject



10
11
12
# File 'lib/elastic_queue/queueable.rb', line 10

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

#queue_mappingObject



29
30
31
32
33
34
35
36
# File 'lib/elastic_queue/queueable.rb', line 29

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



6
7
8
# File 'lib/elastic_queue/queueable.rb', line 6

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