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
          @index._crutches.each_key do |name|
            singleton_class.class_eval <<-METHOD, __FILE__, __LINE__ + 1
              def #{name}
                @#{name} ||= @index._crutches[:#{name}].call @collection
              end
            METHOD
          end
        end