Class: AgnosticBackend::Indexable::Config::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/agnostic_backend/indexable/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_class:, indexable_class:, primary: true, **options) ⇒ Entry

Returns a new instance of Entry.



11
12
13
14
15
16
# File 'lib/agnostic_backend/indexable/config.rb', line 11

def initialize(index_class:, indexable_class:, primary: true, **options)
  @index_class = index_class
  @indexable_class = indexable_class
  @primary = primary
  @options = options
end

Instance Attribute Details

#index_classObject (readonly)

Returns the value of attribute index_class.



8
9
10
# File 'lib/agnostic_backend/indexable/config.rb', line 8

def index_class
  @index_class
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/agnostic_backend/indexable/config.rb', line 8

def options
  @options
end

Instance Method Details

#create_indexObject



22
23
24
# File 'lib/agnostic_backend/indexable/config.rb', line 22

def create_index
  @index_class.new(@indexable_class, primary: @primary, **@options)
end

#primary?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/agnostic_backend/indexable/config.rb', line 18

def primary?
  @primary
end