Sha256: 6bd325473d658e4bd8dfd434a461b92efb42410b7ade839184b5b9e484505a74

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

module Georgia
  module Indexer
    module Adapter

      class << self

        def included(klass)
          load_extension(klass)
        end

        def load_extension(klass)
          extension = Extension.new(klass)
          begin
            require extension.path
            klass.send(:include, extension.name)
          rescue => ex
            raise "No extension for the #{Georgia.indexer} indexer: #{ex.message}"
          end
        end

        class Extension

          def initialize klass
            @klass = klass
          end

          def name
            name = @klass.to_s.gsub('::', '') + 'Extension'
            "#{Georgia::Indexer.adapter}::#{name}".constantize
          end

          def path
            "georgia/indexer/extensions/#{Georgia.indexer}_adapter/#{filename}"
          end

          def filename
            @klass.to_s.underscore
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
georgia-0.7.8 lib/georgia/indexer/adapter.rb
georgia-0.7.7 lib/georgia/indexer/adapter.rb