Sha256: 3ec351afa468bf9dca535bfae43683023e78b1af33fa92e5235fe94c6700e601
Contents?: true
Size: 956 Bytes
Versions: 1
Compression:
Stored size: 956 Bytes
Contents
module Elastic::Types class BaseType < Elastic::Core::Serializer def self.target=(_name_or_class) definition.targets = [_name_or_class] end def self.targets=(_names_or_classes) definition.targets = _names_or_classes end def self.definition @definition ||= Elastic::Core::Definition.new.tap do |definition| definition.targets = [default_target] unless default_target.nil? end end def self.freeze_index_definition unless definition.frozen? definition.fields.each do |field| field.disable_mapping_inference if original_value_occluded? field.name end definition.freeze end end def initialize(_object) super(self.class.definition, _object) end private_class_method def self.default_target @default_target ||= begin target = to_s.match(/^(.*)Index$/) target ? target[1] : nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elastic-rails-0.5.0 | lib/elastic/types/base_type.rb |