class Chewy::Index::Crutch::Crutches

Public Class Methods

new(index, collection) click to toggle source
# File lib/chewy/index/crutch.rb, line 12
def initialize(index, collection)
  @index = index
  @collection = collection
  @crutches_instances = {}
end

Public Instance Methods

[](name) click to toggle source
# File lib/chewy/index/crutch.rb, line 28
def [](name)
  @crutches_instances[name] ||= @index._crutches[:"#{name}"].call(@collection)
end
method_missing(name, *, **) click to toggle source
Calls superclass method
# File lib/chewy/index/crutch.rb, line 18
def method_missing(name, *, **)
  return self[name] if @index._crutches.key?(name)

  super
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File lib/chewy/index/crutch.rb, line 24
def respond_to_missing?(name, include_private = false)
  @index._crutches.key?(name) || super
end