Sha256: dd87284f486ba76a9b85392e46fdbe1685b4d9e90fddefe31249062ff90bc0f4

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

module Groonga
  module ExpressionRewriters
    @@rewriters = {}

    class << self
      def register(name, rewriter_class)
        @@rewriters[name] = rewriter_class
      end

      def classes
        rewriters_table_name =
          Conf["expression_rewriter.table"] || "expression_rewriters"
        rewriters_table = Context.instance[rewriters_table_name]
        return [] if rewriters_table.nil?

        rewriters_table.collect do |id|
          record = Record.new(rewriters_table, id)
          name = record.key
          rewriter = @@rewriters[name]
          if rewriter.nil?
            plugin_name = record.plugin_name.value
            require plugin_name
            rewriter = @@rewriters[name]
            raise "unknown rewriter: <#{name}>:<#{plugin_name}>" if rewriter.nil?
          end
          rewriter
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rroonga-5.1.1-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_rewriters.rb
rroonga-5.1.1-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_rewriters.rb
rroonga-5.0.9-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_rewriters.rb
rroonga-5.0.9-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/expression_rewriters.rb