Class: Elastic::Types::BaseType
Instance Attribute Summary
#object
Class Method Summary
collapse
Instance Method Summary
collapse
#as_elastic_document, #as_elastic_source, #fields, original_value_occluded?
Constructor Details
#initialize(_object) ⇒ BaseType
Returns a new instance of BaseType.
28
29
30
|
# File 'lib/elastic/types/base_type.rb', line 28
def initialize(_object)
super(self.class.definition, _object)
end
|
Class Method Details
.definition ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/elastic/types/base_type.rb', line 13
def self.definition
@definition ||= begin
pre_definition.fields.each do |field|
field.disable_mapping_inference if original_value_occluded? field.name
end
pre_definition.freeze
pre_definition
end
end
|
.freeze_definition ⇒ Object
24
25
26
|
# File 'lib/elastic/types/base_type.rb', line 24
def self.freeze_definition
definition end
|
.pre_definition ⇒ Object
7
8
9
10
11
|
# File 'lib/elastic/types/base_type.rb', line 7
def self.pre_definition
@pre_definition ||= Elastic::Core::Definition.new.tap do |definition|
definition.target = default_target unless default_target.nil?
end
end
|
.target=(_name_or_class) ⇒ Object
3
4
5
|
# File 'lib/elastic/types/base_type.rb', line 3
def self.target=(_name_or_class)
pre_definition.target = _name_or_class
end
|