Sha256: efc6b12b244e8bfc92200ddceb5201e15cbbcae5da986bd10750e7f723981bef

Contents?: true

Size: 796 Bytes

Versions: 7

Compression:

Stored size: 796 Bytes

Contents

# encoding: UTF-8

module Spontaneous::Plugins::Site
  module Search
    extend ActiveSupport::Concern

    module ClassMethods
      def index(name, &definition)
        instance.index(name, &definition)
      end

      def indexes
        instance.indexes
      end

      def indexer(revision)
        indexer = S::Search::CompoundIndexer.new(revision, indexes.values)
        begin
          yield(indexer)
        ensure
          indexer.close
        end
      end
    end # ClassMethods

    def indexes
      @indexes ||= {}
    end

    def [](name)
      indexes[name.to_sym]
    end

    def []=(name, index)
      indexes[name.to_sym] = index
    end

    def index(name, &definition)
      index = S::Search::Index.new(name, &definition)
      self[name] = index
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spontaneous-0.2.0.alpha7 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha2 lib/spontaneous/plugins/site/search.rb
spontaneous-0.2.0.alpha1 lib/spontaneous/plugins/site/search.rb