mysql2_query_filter 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe3853f17ab44d9af7f15278c5fb713640b7e4d
|
4
|
+
data.tar.gz: 5d8383dae65499f5b62a12e1793e581f8c59d697
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef687ee03b2910127334dfb99661492524bd1518e50cc67207cab42ff50c4e046ea17198cc2598e69850a57cfe7f978514fbb8172a484d29962ebb777173f994
|
7
|
+
data.tar.gz: a4878c398a152b6018782bfaae30fbf395dce40bc3ac5b040068dec45d5e66378a1d2d232849dd9ef4107611ca088de983e1d2076df37bcb1e0532c7f8aede06
|
@@ -1,2 +1,27 @@
|
|
1
1
|
module Mysql2QueryFilter::Plugin
|
2
|
+
|
3
|
+
def self.register(name, klass)
|
4
|
+
name = name.to_s
|
5
|
+
@plugins ||= {}
|
6
|
+
|
7
|
+
if @plugins.has_key?(name)
|
8
|
+
raise "Plugin has already been registered: #{name}"
|
9
|
+
end
|
10
|
+
|
11
|
+
@plugins[name] = klass
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get(name)
|
15
|
+
name = name.to_s
|
16
|
+
|
17
|
+
require "mysql2_query_filter/plugin/#{name}"
|
18
|
+
|
19
|
+
plugin = @plugins[name]
|
20
|
+
|
21
|
+
unless plugin
|
22
|
+
raise "Plugin is not found: #{name}"
|
23
|
+
end
|
24
|
+
|
25
|
+
plugin
|
26
|
+
end
|
2
27
|
end
|
data/lib/mysql2_query_filter.rb
CHANGED
@@ -5,7 +5,6 @@ require 'mysql2_query_filter/version'
|
|
5
5
|
require 'mysql2_query_filter/mysql2_client_ext'
|
6
6
|
require 'mysql2_query_filter/plugin'
|
7
7
|
require 'mysql2_query_filter/plugin/filter'
|
8
|
-
require 'mysql2_query_filter/plugins'
|
9
8
|
require 'mysql2_query_filter/query_filter'
|
10
9
|
|
11
10
|
Mysql2::Client.class_eval do
|
@@ -31,8 +30,4 @@ module Mysql2QueryFilter
|
|
31
30
|
def self.disable
|
32
31
|
@@enabled = false
|
33
32
|
end
|
34
|
-
|
35
|
-
def self.register(name, klass)
|
36
|
-
Mysql2QueryFilter::Plugins.register(name, klass)
|
37
|
-
end
|
38
33
|
end
|