Class: AgnosticBackend::Index
- Inherits:
-
Object
- Object
- AgnosticBackend::Index
show all
- Defined in:
- lib/agnostic_backend/index.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(indexable_klass, primary: true, **options) ⇒ Index
Returns a new instance of Index.
6
7
8
9
10
11
|
# File 'lib/agnostic_backend/index.rb', line 6
def initialize(indexable_klass, primary: true, **options)
@indexable_klass = indexable_klass
@primary = primary
@options = options
parse_options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4
5
6
|
# File 'lib/agnostic_backend/index.rb', line 4
def options
@options
end
|
Instance Method Details
29
30
31
|
# File 'lib/agnostic_backend/index.rb', line 29
def configure(new_schema = nil)
raise NotImplementedError
end
|
#indexer ⇒ Object
25
26
27
|
# File 'lib/agnostic_backend/index.rb', line 25
def indexer
raise NotImplementedError
end
|
#name ⇒ Object
17
18
19
|
# File 'lib/agnostic_backend/index.rb', line 17
def name
@indexable_klass.index_name
end
|
#parse_option(option_name, optional: false, default: nil) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/agnostic_backend/index.rb', line 37
def parse_option(option_name, optional: false, default: nil)
if options.has_key?(option_name)
options[option_name]
elsif optional
default
else
raise "#{option_name} must be specified"
end
end
|
#parse_options ⇒ Object
33
34
35
|
# File 'lib/agnostic_backend/index.rb', line 33
def parse_options
raise NotImplementedError
end
|
#primary? ⇒ Boolean
13
14
15
|
# File 'lib/agnostic_backend/index.rb', line 13
def primary?
@primary
end
|
#schema ⇒ Object
21
22
23
|
# File 'lib/agnostic_backend/index.rb', line 21
def schema
@indexable_klass.schema
end
|