module Elasticord::Base::ClassMethods

Public Instance Methods

client(sub_index = nil, sub_type = nil) click to toggle source
# File lib/elasticord/base.rb, line 10
def client(sub_index = nil, sub_type = nil)
  full_type = [type, sub_type].compact.join('_')


  full_index = [index, sub_index].compact.join('_')

  Client::Base.new \
    Elasticord.elastic_search_client, self, full_index, full_type
end
index() click to toggle source
# File lib/elasticord/base.rb, line 29
def index
  return @index if defined?(@index)

  @index = (superclass.index || '').dup if superclass.respond_to? :index

  @index = @index.presence || Elasticord::Config.get(:index_namespace)
end
index=(new_index) click to toggle source
# File lib/elasticord/base.rb, line 37
def index=(new_index)
  @index = new_index
end
type() click to toggle source
# File lib/elasticord/base.rb, line 41
def type
  return @type if defined?(@type)

  return (@type = '_all') if name.nil? || name == 'Elasticord::Base'

  @type = name.split('::').last.underscore
end