Sha256: 7b46ce6c9f4065e3efb7801ed9036102b186cbebc1ba76c220f6f0c7de34362f

Contents?: true

Size: 439 Bytes

Versions: 10

Compression:

Stored size: 439 Bytes

Contents

module Noodall
  module Indexer
    def self.configure(model)
      model.class_eval do
        cattr_accessor :indexes
      end
      model.indexes = []
    end
    module ClassMethods
      def ensure_index(*args)
        indexes << args
      end

      def create_indexes!
        indexes.each do |args|
          puts "Creating index #{args.inspect}"
          collection.create_index(*args)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
noodall-core-0.6.3 lib/noodall/indexer.rb
noodall-core-0.6.2 lib/noodall/indexer.rb
noodall-core-0.6.1 lib/noodall/indexer.rb
noodall-core-0.5.7 lib/noodall/indexer.rb
noodall-core-0.6.0 lib/noodall/indexer.rb
noodall-core-0.5.6 lib/noodall/indexer.rb
noodall-core-0.5.5 lib/noodall/indexer.rb
noodall-core-0.5.4 lib/noodall/indexer.rb
noodall-core-0.5.3 lib/noodall/indexer.rb
noodall-core-0.5.1 lib/noodall/indexer.rb