Sha256: c82980ee1d9dab585a4310401103013de9c3df0203510bd0a19bb0a3cfdb0e8a

Contents?: true

Size: 454 Bytes

Versions: 4

Compression:

Stored size: 454 Bytes

Contents

module Mysql2QueryFilter::Plugin

  def self.register(name, klass)
    name = name.to_s
    @plugins ||= {}

    if @plugins.has_key?(name)
      raise "Plugin has already been registered: #{name}"
    end

    @plugins[name] = klass
  end

  def self.get(name)
    name = name.to_s

    require "mysql2_query_filter/plugin/#{name}"

    plugin = @plugins[name]

    unless plugin
      raise "Plugin is not found: #{name}"
    end

    plugin
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mysql2_query_filter-0.1.1 lib/mysql2_query_filter/plugin.rb
mysql2_query_filter-0.1.0 lib/mysql2_query_filter/plugin.rb
mysql2_query_filter-0.0.7 lib/mysql2_query_filter/plugin.rb
mysql2_query_filter-0.0.6 lib/mysql2_query_filter/plugin.rb