Class: Chewy::Type

Inherits:
Object show all
Includes:
Index::Search, Actions, Import, Mapping, Observe, Wrapper
Defined in:
lib/chewy/type.rb,
lib/chewy/type/import.rb,
lib/chewy/type/actions.rb,
lib/chewy/type/mapping.rb,
lib/chewy/type/observe.rb,
lib/chewy/type/wrapper.rb,
lib/chewy/type/adapter/base.rb,
lib/chewy/type/adapter/object.rb,
lib/chewy/type/adapter/active_record.rb

Defined Under Namespace

Modules: Actions, Adapter, Import, Mapping, Observe, Wrapper

Instance Attribute Summary

Attributes included from Wrapper

#_data, #_object, #attributes

Class Method Summary collapse

Methods included from Wrapper

#==, #initialize, #method_missing, #respond_to_missing?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chewy::Type::Wrapper

Class Method Details

.adapterObject

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/chewy/type.rb', line 25

def self.adapter
  raise NotImplementedError
end

.const_missing(name) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/chewy/type.rb', line 41

def self.const_missing(name)
  to_resolve = "#{self.to_s}::#{name}"
  to_resolve[index.to_s] = ''

  @__resolved_constants ||= {}

  if to_resolve.empty? || @__resolved_constants[to_resolve]
    super
  else
    @__resolved_constants[to_resolve] = true
    to_resolve.constantize
  end
rescue NotImplementedError
  super
end

.indexObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/chewy/type.rb', line 21

def self.index
  raise NotImplementedError
end

.search_indexObject



33
34
35
# File 'lib/chewy/type.rb', line 33

def self.search_index
  index
end

.search_typeObject



37
38
39
# File 'lib/chewy/type.rb', line 37

def self.search_type
  type_name
end

.type_nameObject



29
30
31
# File 'lib/chewy/type.rb', line 29

def self.type_name
  adapter.type_name
end