Sha256: 52003aa3087e1ee7a080417ebefdd01227129828d89aed45736ca6a42cbd87b4

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

module Elos::Index::Mappings
  extend ActiveSupport::Concern

  included do
    cattr_writer :mappings
  end

  class_methods do
    def mappings(mappings = nil)
      if mappings
        set_mappings(mappings)
      else
        self.class_variable_get(:@@mappings)
      end
    end

    protected

    def set_mappings(mappings)
      mps = mappings.is_a?(Proc) ? mappings.() : mappings.deep_dup
      mps[:properties].merge!(_destroyed: boolean_property)
      self.mappings = { type_name => mps }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elos-1.0.12 lib/elos/index/mappings.rb