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: 9c50f12b448fa3373216e7edae47d5a61a85e17b
4
- data.tar.gz: 2c4e974cb8a6c5ab134d1ac6836c83235a7a6f3c
3
+ metadata.gz: efe3853f17ab44d9af7f15278c5fb713640b7e4d
4
+ data.tar.gz: 5d8383dae65499f5b62a12e1793e581f8c59d697
5
5
  SHA512:
6
- metadata.gz: e69d1640e1a1ab1472c537a97e9b72bc518747ad011daaa15fa5fa34715c509a997caa84c7ee20401e0fe1e627feefd57855b28a592fb54a1021f5dd72a74bb2
7
- data.tar.gz: f9167e0087d77aeae3278a958300cf1cf267a39780146f2ae1a5920d826d92939cff75f57a6d493ee033eb9ba2df676183c0c774f5d5c8b80089ead158de4f1d
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
@@ -4,7 +4,7 @@ class Mysql2QueryFilter::QueryFilter
4
4
  end
5
5
 
6
6
  def plugin(name, options = {})
7
- filter_class = Mysql2QueryFilter::Plugins[name]
7
+ filter_class = Mysql2QueryFilter::Plugin.get(name)
8
8
  add(filter_class, options)
9
9
  end
10
10
 
@@ -1,3 +1,3 @@
1
1
  module Mysql2QueryFilter
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql2_query_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara